Friday , 31 March 2017
Home » Tutorials » C programming » C Program to Find the Reverse of a given number by using Recursion

C Program to Find the Reverse of a given number by using Recursion

Program :

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

int main()
{
 int a;
 printf("Type a value : ");
 scanf("%d",&a);
 printf("Reverse: %d",rev(a,0));
 return 0;
}

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

About Rajeel

I'm Rajeel, a teen blogger from India who loves computers, sports, internet and all other kind of tech stuffs. This blog thing is one of my favourite hobby and the one that eats up much of my time. But Really, I'm loving it :) Find me in G+

Leave a Reply

Your email address will not be published. Required fields are marked *

*

Scroll To Top