Answer to Question #159551 in C++ for Earl

Question #159551

This is a silly program to help you practice with combined assignment operators, such as +=. Use ONLY these types of operators as you manipulate the user's lucky number by always using the number 10. See output below for details.

 

Output:

Enter a lucky number (must be whole number) and I will manipulate it using my number:   [assume user inputs 7]

Your lucky number + 10 equals 17

Now I will multiply the previous result by 10, which equals 170

Next I subtract the previous result by 10, which equals 160

Lastly, I divide the previous result by 10, which equals 16


1
Expert's answer
2021-02-01T08:01:46-0500
#include <iostream>

using namespace std;

int main()
{
int your_lky; //my_fav is equal to 10 as given in quistion
cout<<"Enter your lucky number(Whole number)\n";
cin>>your_lky; //take lucky num.
your_lky+=10; //your_lky=your_lky+10
your_lky*=10; //your_lky=your_lky*10
your_lky-=10; //your_lky=your_lky-10
your_lky/=10; //your_lky=your_lky/10
cout<<"after manipuletion number becomes="<<your_lky;

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 the first!

Leave a comment

LATEST TUTORIALS
New on Blog