C program to find a reverse number.

01 #include <stdio.h>
02
03 int main()
04 {
05 int n, reverse = 0;
06 printf("Enter a number to reverse:n");
07 scanf("%d",&n);
08
09 while (n != 0)
10 {
11 reverse = reverse * 10;
12 reverse = reverse + n%10;
13 n = n/10;
14 }
15 printf("Reverse of entered number is = %dn",reverse);
16
17 return 0;
18 }

 OUTPUT :

Enter a number to reverse:

1234

Reverse of entered number is = 4321

Related Post

Leave a Reply

Your email address will not be published. Required fields are marked *