Bhuvan InfoTech Android App

Download our Android App and browse Technical News, Projects, Computer Tricks more easily with lots of Interesting Features.

Tuesday, June 14, 2016

Reverse a number by Recursion | C program

#include<stdio.h>
int revs(int,int);

int main()
{
 int no;
 printf("Enter a number : ");
 scanf("%d",&no);
 printf("Reverse: %d",revs(no,0));
 return 0;
}

int revs(int i,int r)  
{
 if(i > 0)  
  return revs(i/10,(r*10)+(i%10));  
 return r;  
}
Bhuvan Arora

No comments:

Amazing Deal !