/*AN IMPLEMENTATION TO REPRESENT PHONE NUMBER INTO REVERSE ORDER IN WHICH THERE ARE 10 DIGITS */
//WE KNOW THAT INT VALUE CAN HAVE ATMOST 9 DIGITS..//
#include<stdio.h>
static int j=0;//j is staic
void rev(int,int*);
int main()
{
int len=0;
int b[20],no[20]={0},i=0;
printf("ENTER THE NO:");
for(i=0;i<2;i++)
{
scanf("%d",&no[i]);//enter the phone number 9 digits once after pressing enter put 10th digit of ur phone number
}
len=9;//9 dogits of 1st entered num[0]...are to be reversed 1st..//
printf("%d",no[1]);
rev(len,no);//cal function to reverse this num[0]...having 9 digits//
return 0;
}
void rev(int len,int* no)
{
// printf("in rev\n");
static int i=0;
static int rem[20]={0};//static means once value is inntialised ...value must be retained ..meANS EITHER FUNCTION IS CALLING AGAIN & AGAIN....REM WILL NOT BE RE-INITIALISED...//
//printf("no=%d\n",no);
if(len>=1)//len>=1 means present number of digits one by one in num[0] will be reversed..//
{
//printf("i=%d\n",i);
// printf("in rev\n");
rem[i]=rem[i]*10;
rem[i]= rem[i] + (no[0] % 10);//further remainder is added to previous remainder by multiplying previous remainder by 10...//& num is again divided by 10 & preserved into num again //
printf("%d",rem[i]);
no[0]=no[0]/10;//divide the number by 10
len--;//len is decremented for reverse of each digit
i++;//increment the i...bcz rem[i] will contained reversed number...untill all the digits are reversed//
rev(len,no);//call function again to reverse the number again//