Reversing Any Number

Program for reverse the number entered by a user :
Code goes like this :

/* Program for reversing any number */
#include<stdio.h>
main()
{
    int rev=0,rem,num;
    printf("Enter any number :");
    scanf("%d",&num);
    while(num!=0)
    {
        rem=num%10;
        rev=rev*10+rem;
        num=num/10;
        }   
    printf("\n The reverse no is: %d",rev);
}

Output  :










Compiler Used : Dev CPP
Share on Google Plus

About Nepali Xoro

Interested in Information Technology, Spreading Knowledge for Nepalease IT Students."Loves Traveling", Listen Music and Surfing web.
    Blogger Comment
    Facebook Comment

0 comments:

Post a Comment