TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
C# Corner
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
How To Reverse A Number in C
Shobana J
Jul 08, 2016
13.2
k
0
1
facebook
twitter
linkedIn
Reddit
WhatsApp
Email
Bookmark
In this blog, you will learn how to reverse a number in C.
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
Next Recommended Reading
Armstrong Number In C