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
#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;
}
Comments
Leave a comment