;

# C Program to Reverse a given number using Recursion

###### Tutorialsrack 03/11/2019 C

In this C program, we will learn how to write a program to reverse a given number using Recursion.

Here is the code of the program to reverse a given number using Recursion.

##### Code - C Program to Reverse a given number using Recursion
``````/*C Program to Reverse a given number using Recursion:*/

#include<stdio.h>
int main(){
int number,reverse_number;

//User would input the number
printf("Enter a Number to Reverse: ");
scanf("%d",&number);

//Calling user defined function to perform reverse
reverse_number=reverse_function(number);
printf("Reversed Number is %d",reverse_number);
return 0;
}
int sum=0,remainder;
int reverse_function(int num){
if(num){
remainder=num%10;
sum=sum*10+remainder;
reverse_function(num/10);
}
else{
return sum;
}
return sum;
}``````
##### Output

Enter a Number to Reverse: 865
Reversed Number is 568
--------------------------------
Process exited after 4.46 seconds with return value 0
Press any key to continue . . .