Question:

What is the value of $ x $ after the execution of the following C language statement? $$ x = -11 % -3; $$

Show Hint

The result of a modulus operation has the same sign as the divisor in C.
Updated On: May 3, 2025
  • 2
  • 4
  • -2
  • 1
Hide Solution
collegedunia
Verified By Collegedunia

The Correct Option is C

Solution and Explanation

The modulus operation calculates the remainder after division. The result of \( -11 % -3 \) is \( -2 \) because when -11 is divided by -3, the remainder is -2.
Thus, the value of \( x \) is \( -2 \).
Was this answer helpful?
0
0

Top Questions on Programming in C

View More Questions