The output of printf("%d", 10 % 3); is:
-
A
3
-
B
1
Correct answer
-
C
0
-
D
10
10 views
Explanation
% is the modulus operator, which gives the remainder. 10 divided by 3 is 3 remainder 1, so the output is 1. Modulus only works with integers.
Reference
Asked in: Matric,FBISE
Doubts & discussion
Not sure why the answer is B? Ask here and get an explanation.
Ask a doubt about this MCQ