R

Ranjeet • 34.60K Points
Instructor I

Q. What is the output of the following code snippet? int x = 10; int y = 20; cout << (x %= y);

  • (A) 10
  • (B) 20
  • (C) 0
  • (D) Error
  • Correct Answer - Option(A)
  • Views: 25
  • Filed under category C++

Explanation by: Ranjeet
The compound assignment operator (%=) calculates the remainder of x divided by y and returns the new value of x, which is 10.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.


Question analytics