-
reverse a number digits
Write program that reverse a number digits. The program will ask the user to enter a number (one variable) consist from three digits then the program reverse the digits of the number.
Note: you must define the number as integer. To solve the problem use the / and the %
The program output might be like this
Enter any number consist from three digits = 123
The reverse of this number= 321
-
-
Marked in red is what you need to figure out. Even with the omissions, someone will probably cyber-whip me for helping you this much.
Code:
#include <iostream>
int main ()
{
short x;
std::cout<<"enter a number";
std::cin>>x;
short a=(x%10);
short b=(?%?)?10;
short c=(x/?);
std::cout<<?<<?<<?<<std::endl;
std::cin.ignore();
std::cin.get();
return 0;
}
-
Yup, that's about as far as you can go without giving the whole game away :)