Reverse of an integer
C program to reverse an integer number.
Program
#include<stdio.h>
#include<conio.h>
void main()
{
int num, rev_num, rem;
printf("Enter the number\t:");
scanf("%d",&num);
rev_num = 0;
while(num != 0)
{
rem = num % 10;
rev_num = rev_num * 10 + rem;
num = num / 10;
}
printf("Reverse Number\t:%d",rev_num);
getch();
}
Output
Enter the number :456
Reverse Number :654