To reverse of a given number in C


Levels of difficulty: / perform operation:

C program to print the reverse of a given number.

C Program

#include <stdio.h>
#include <conio.h>
void main()
{
	unsigned long num,rev;
	clrscr();
	printf("\nENTER A NUMBER: ");
	scanf("%lu",&num);
	printf("\nTHE REVERSE OF THE NUMBER %lu IS ",num);
	do
        {
		rev=num%10;
		num=num/10;
		printf("%lu",rev);
	}
	while(num!=0);
	getch();
}


Output







Quantitative Aptitude
Reasoning
Programming
Interview