10 Mar 2013

Reverse number

/*


program to reverse a number.....

*/
 


#include<stdio.h>
#include<conio.h>


void main ()
{
 

long int num,mod,rev=0;
 

printf("Enter a number:");
scanf("%ld", &num);
while (num>0)
{
mod=num%10;
rev=(rev*10)+mod;
num=num/10;
}

printf("Reverse of the given number: %ld", rev);
 

getch();
}

Categories: , ,

0 comments:

Post a Comment

Copyright © UPgradeCODING | Powered by Blogger