Reverse Number Example Program In C Programming Language

Example Program For Reverse Number In C Programming

/*  Example Program For Reverse Number In C Programming Language
    little drops @ thiyagaraaj.com

    Coded By:THIYAGARAAJ MP             */

// Header Files
#include<stdio.h>
#include<conio.h>

//Main Function
int main()
{
    //Varibale Declaration
    long int n,n1,reverse=0;

    printf("Enter the Number:");
    scanf("%ld",&n);

    while(n!=0)
    {
        n1=n%10;
        reverse=reverse*10+n1;
        n=n/10;
    }
    printf("Reverse Number Is :%ld",reverse);

    // Wait For Output Screen
    getch();

    //Main Function return Statement
    return 0;
}

Sample Output:

Enter the Number:78965
Reverse Number Is :56987

Top Pages