Recursion in C
/*C program to reverse a number*/#include<stdio.h>
reverse_function(int num);
int main()
{
int num,reverse_number;
printf("Enter any number:");
scanf("%d",&num); //User would input the number
reverse_number=reverse_function(num); //Calling user defined function to perform reverse
return 0;
}
int sum=0,rem;
reverse_function(int num)
{
if(num)
{
rem=num%10;
sum=sum*10+rem;
reverse_function(num/10);
}
else
return sum;
return sum;
}
Expected Output:
Enter any number: 2345
After reverse the no is : 5432