Table of Contents
C Program to Reverse a Number
C Program to Reverse a Number or find the reverse of a number is mostly asked in University exam.
The program is given below
#include <stdio.h>
#include<conio.h>
void main( )
{
int n, reverse = 0, remainder;
printf(“Enter an integer: “);
scanf(“%d”, &n);
while (n != 0) {
remainder = n % 10;
reverse = reverse * 10 + remainder;
n /= 10;
}
printf(“Reversed number = %d”, reverse);
getch();
}
Output