# Program to Reverse Number in C++

Here you will get program to reverse number in C++.

Output

Enter any number:12674
The reversed number is 47621

Category: Loops A crazy computer and programming lover. He spend most of his time in programming, blogging and helping other programming geeks.

## 10 thoughts on “Program to Reverse Number in C++”

1. Kennedy Ochieng

what the statement d=n%10 actually means

1. Neeraj Mishra

% is used to get remainder of a number by dividing it by other number. And if we do modulus of number by 10 then the last digit of number is remainder. Means 123%10=3 or 12%10=2. I hope this will make you clear.

2. Varun Gude

I used this program but it is not working for numbers starting with zero.
For example,
001 should give me 100; but it gives me 1

1. Neeraj Mishra

001 is considered as 1. This program is for number reverse not string reverse.

3. ali

what the statement rev=(rev*10)+d
what the value of rev in this statement

4. anuj srivastava

this was really helpful… thanku.. but I couldn’t find the solution to write a program to enter a number and print the sum of digits.

1. Nitish varma

#include
#include
#include
void main()
{
clrscr();
int n,x,y,sum;
cout<>n;
x=n%10;
y=n/10;
sum=x+y;
cout<<"the sum is:"<<sum<<endl;
getch();
}

5. ashwani

how will you print the reverse of 001

6. noor hameed

why when I enter 6000002345 the output is false

7. MESAME