Home >>Cpp Programs >Reverse Number Program in C++
C++ program to reverse number is basically a program that is used to reverse it or in simple words, it can be said that this program can be used to reverse the digits of a provided number.
In this very simple program, the number is first taken from the user as an input and then it is reversed. And this is done very easily in C++ programming language just by the use of arithmetic and loop operators.
Here is an example of a program in C++ language that will clear your concept about the topic and illustrate to you that how a number is reversed:
#include <iostream> using namespace std; int main() { int num, rev=0,rem; cout<<"Please Enter Your number : "; cin>>num; while(num!=0) { rem=num%10; rev=rev*10+rem; num/=10; } cout<<"Here is the Reversed Number: "<< rev <<endl; return 0; }