0

3+2+1-5+4%2-1/4+6

The answer is 7, i dont get it. Can someone show me step by step how to get it?

22nd Dec 2017, 5:38 PM
ChunHeng Ong
ChunHeng Ong - avatar
4 Réponses
+ 9
3+2+1-5+4%2-1/4+6 modulus and division operator has higher priority so 4%2=0 and 1/4=0 then 3+2+1-5=1 4%2=0 -1/4=0 so now only 1+6 which is equal to 7 so output is 7
22nd Dec 2017, 5:45 PM
MsJ
MsJ - avatar
0
Nope it won't be 7.In programming there are some function that can wrap this float number and give result in integer. I think 😒
22nd Dec 2017, 5:43 PM
NabiL
NabiL - avatar
0
-1/4=0? What?😐
22nd Dec 2017, 9:50 PM
ChunHeng Ong
ChunHeng Ong - avatar
0
If all numbers are in floating point, then ans will be 6.75. Figured it out thx guys. Seems floating point will be more accurate.
28th Dec 2017, 9:39 PM
ChunHeng Ong
ChunHeng Ong - avatar