65 660
Assignments Done
99,2%
Successfully Done
In October 2018

Answer to Question #24355 in C++ for Aaron Stewart

Question #24355
write compile and run a c++ program to reverse the digits of a positive integer number. For example if the number 8735 is entered, the number displayed should be 5378.( hint: use do while ) After a units digit is displayed, dividing the number by 10 sets up the number for the next iteration
Expert's answer
#include <iostream>
using namespace std;

int main()

{

int num, rev;

cout <<"Input: ";
cin >> num;

cout <<"Output: ";

do
{
rev = num;
num=num/10;
cout << rev;
} while(num>0);

cout <<"
";

return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be first!

Leave a comment

Ask Your question

Submit
Privacy policy Terms and Conditions