Skip to content
Home » C Program to Find Reverse of a Number

C Program to Find Reverse of a Number

Learn about C Program to Find Reverse of a Number in the below code example. Also refer the comments in the code snippet to get a detailed view about what’s actually happening.

C Program to Find Reverse of a Number

Source code:

 #include<stdio.h>
 int main()
 {
     int number, lastDigit;

     printf("Enter a number: ");
     scanf("%d",&number);

     while( number!=0 )
     {
         lastDigit = number%10;
         printf("%d",lastDigit); 
         number /= 10;
     }

     return 0;
 }

Output:

Enter a number: 654
456

Hope above code works for you and Refer the below Related Codes to gain more insights. Happy coding and come back again.

Similar Codes :
C Program to Find Reverse of a Number using while loop
C program to solve the quadratic equation