Question 12
Back to Exercise
What happens with double r = 7.5 % 2;?
- A r is 1.5
- B A compile error: % needs integer operands; use fmod() Correct
- C r is 1
- D r is 0
Correct Answer: Option B
The % operator is defined only for integer types. fmod(7.5, 2) from <math.h> gives 1.5.
Discussion & Comments 0
Share your method, a shortcut, or ask about a step you didn't follow.
No comments yet. Be the first to share your solution!