Sunday, August 7, 2011

Number in reverse


#include<stdio.h>

void main()
{
int num,rem,rev=0,dup;
clrscr();
printf("Enter a number :");
scanf("%d",&num);
dup=num;
while(num>0)
     {
     rem=num%10;
     rev=rev*10+rem;
     num=num/10;
     }
printf("reverse of %d is : %d ",dup,rev);
getch();
}

0 comments:

Post a Comment