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

7 thoughts on “Program to Reverse Number in C++

    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.

      Reply
  1. 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

    Reply
  2. ali

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

    Reply
  3. 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.

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *