Showing posts with label reverse number Program in C. Show all posts
Showing posts with label reverse number Program in C. Show all posts
reverse number Program in C

reverse number Program in C

C Program to reverse number

In this Program we will using loop and arithmetic operators and make a Program to reverse Integer Numbers. First, we will getting number as input from the user and reversing that number.

Lets Understand Program Steps

  1. #include<stdio.h>  
  2. #include<conio.h>  
  3. main()  
  4. {  
  5. int n, reverse=0, rem;  
  6. clrscr();  
  7. printf("Enter a number: ");  
  8.   scanf("%d", &n);  
  9.   while(n!=0)  
  10.   {  
  11.      rem=n%10;  
  12.      reverse=reverse*10+rem;  
  13.      n/=10;  
  14.   }  
  15.   printf("Reversed Number: %d",reverse);  
  16. getch();  
  17. }  
Output:
Enter a number: 123
Reversed Number: 321

Popular Posts