76 780
Assignments Done
98,5%
Successfully Done
In June 2019

Answer to Question #46701 in C++ for mehdi

Question #46701
write a program to read three digit numbers and compute its inverse & display it on screen
for example:
x=364
y=463
cout<<y;
Expert's answer
#include<iostream>
#include<string>

using namespace std;
//main method
int main() {
//promt user to enter number
cout<<"Enter number: ";
int number;
//read number
cin>>number;
int inverseNumber = 0;
while(number > 0)
{
inverseNumber = inverseNumber*10 + (number % 10);
number = number/10;
}
// display it on screen
cout<<"Inverse number is: "<<inverseNumber<<endl;
//delay
system("pause");
//return 0
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