C Program to reverse a Number | Reverse number program in C languge

Spread the love

Description: 

This program accepts one integer from the user and Generates Reverse of given number.

Program :

  1. #include<stdio.h>
  2. int main()
  3. {
  4.         int num,rem,temp,rev_num;
  5.         printf(“Enter Number : “);
  6.         scanf(“%d”,&num);
  7.         temp = num;
  8.         rev_num = 0;
  9.         while(temp > 0)
  10.         {
  11.                 rem = temp % 10;
  12.                 rev_num = (rev_num * 10) + rem ;
  13.                 temp = temp / 10;
  14.         }
  15.         printf(“Original Number is : %d n, num);
  16.         printf(“Reversed Number is : %d n, rev_num);
  17.         return 0;
  18. }

Output :

Related Programs:

Venkatesh Macha

Hi Guys, I am Venkatesh Macha. I am a programmer and an Open Source enthusiast, Presently working as a Software Engineer. Apart from that, I love to explore new technologies and things.

You may also like...

Leave a Reply