C program to reverse of a number.
Reverse of a number :
Reverse.c
#include<stdio.h>
int reverse(int n);
int main(void)
{
int num;
printf("Enter any number to reverse : ");
scanf("%d",&num);
printf("Reverse of given number : %d\n",reverse(num));
return 0;
}
int reverse(int n)
{
int rev=0;
do
{
rev=rev*10+n%10;
n/=10;
}while(n>0);
return rev;
}
Output:
Termial
Enter any number to reverse : 45623
Reverse of given number : 32654
Happy Learning 🙂