Tech
News
Videos
Forums
Jobs
Books
Events
More
Interviews
Live
Learn
Training
Career
Members
Blogs
Challenges
Certification
Contribute
Article
Blog
Video
Ebook
Interview Question
Collapse
Feed
Dashboard
Wallet
Learn
Achievements
Network
Refer
Rewards
SharpGPT
Premium
Contribute
Article
Blog
Video
Ebook
Interview Question
Register
Login
How To Reverse A Number in C
WhatsApp
Shobana J
8y
13.8
k
0
1
25
Blog
rvrse.zip
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;
}
Explanation
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
Reverse A Number
C
Up Next
Armstrong Number In C
Ebook Download
View all
Printing in C# Made Easy
Read by 22.5k people
Download Now!
Learn
View all
Membership not found