NextIndexPrevious

Programs in C language

6. Program to find Reverse number of given number.
#include<stdio.h>

void main()
{
    int n, r, rev=1;
    clrscr();
    printf("Enter a number:");
    scanf("%d",&n);
    
    while(n>0)
    {
    	r = n%10;
        rev=(rev*10)+r;
        n = n/10;
    }
    
    printf("Reverse number is %d",rev);
    getch();
}
Input :

7458
Output :

Reverse number is 8547



Father of C Language
Dennis Ritchie

Dennis Ritchie

Born: September 9, 1941, Bronxville
Died: October 9, 2011, Murray Hill
Google+