Introduction
- In this article, I'm going to explain how to reverse a number in C language.
Software Requirements
- Turbo C++ OR C
Programming
- #include<stdio.h>
- int main()
- {
- int n, reverse = 0;
- printf("Enter a number to reverse\n");
- scanf("%d",&n);
- while (n != 0)
- reverse = reverse * 10;
- reverse = reverse + n%10;
- n = n/10;
- }
- printf("Reverse of entered number is = %d\n", reverse);
- return 0;
- }
- To reverse a number in C, we can use the following code where the number is entered by the user, and then it is reversed on the output screen.

Output



Vignesh ManiPosted Jul 9, 2016, 5:43 PM
Good