#include<stdio.h>
#include<conio.h>
void main()
{
int num,rev;
clrscr();
printf("\nEnter a number :");
scanf("%d",&num);
rev=reverse(num);
printf("\nAfter reverse the no is
:%d",rev);
getch();
}
int sum=0,r;
reverse(int num)
{
if(num)
{
r=num%10;
sum=sum*10+r;
reverse(num/10);
}
else
return sum;
}
No comments:
Post a Comment