0

Simple calculation ??

I don't understand why the answer to this is 10. int a = 10, b; b = a % (a + (a+1)/a); cout << b Parentheses first: 10 % (10 +11/10) Then?? What am I missing? Thanks

20th Mar 2019, 8:54 PM
Heather
Heather - avatar
2 Respostas
+ 2
11/10 is 1, + 10 is 11 10 % 11 is 10. What output are you expecting?
20th Mar 2019, 8:56 PM
Vlad Serbu
Vlad Serbu - avatar
0
Oh, of course. I just need more coffee. Thanks!
20th Mar 2019, 8:57 PM
Heather
Heather - avatar