Practice Question 1–
Simple computation
nint main() {
n int x = 7; // variable declaration and initialization
n int y = 23; // variable declaration and initialization
n y = x + y;
n cout << "x=" << x << " y =" << y << endl;
n x = y / x;
n cout << "x=" << x << " y =" << y << endl;
n x = 4; // variable assignment
n y = 23; // variable assignment
n cout << "y % x = " << y % x << endl;
n cout << "x= " << x << " y=" << y << endl;
n return 0;
n}
Answer :
x=7 y =30
x=4 y =30
y % x =3
x= 4 y= 23