C Programming :: Floating Point Problems - Discussion
4 / 6
If a = -11 and b = -3 what is the value of a%b?
A-3
B3
C2
D-2
Show Explanation
C define % operator operation for a%b as below:
a = (a/b) * b + a%b
Here dividend is negative so the answer will be -2
Important Points:
=> The answer will be -2 in the scenario where a = -11 and b = 3
=> The answer will be 2 in the scenario when a = 11 and b = -3 or 3
Asked In ::
Note: % is a reminder operator in c programming (and programming language). For the remainder operator, the sign of the result is the same as the sign of the dividend.
C define % operator operation for a%b as below:
a = (a/b) * b + a%b
Here dividend is negative so the answer will be -2
Important Points:
=> The answer will be -2 in the scenario where a = -11 and b = 3
=> The answer will be 2 in the scenario when a = 11 and b = -3 or 3
Read Full Answer
Report Error
Please Login First Click Here