C++ program to reverse a number
In this program, we will learn how to reverse an integer number in C++?
Here, we will read an integer number through the keyboard and print its reverse number, let suppose input number is "16789", program will print "98761".
Extras:
- Declaring integer variable num (to store input number) and sum (to store reverse number) as long integer so that we can input and reverse a large value [Read long integer and its value range].
- Checking that input number is positive or not, if it is negative program will be terminated.
Reverse an integer number in C++
Output
need an explanation for this answer? contact us directly to get an explanation for this answer