This string gives you an output of 12.
you follow order of operations so:
3 * 6 = 18
18 / 4 = 4.5 ; since result is declared an integer, 4.5 is truncated to simply 4
4 / 3 = 1 with a remainder of 1 ; because of the % , this results in a value of 1
13 - 1 = 12
12 is the result and remains an integer.
Perfect analysis, Ryan, one thing though:
ReplyDelete"This string gives you an output of 12."
There is a technical inaccuracy in referring to this as a string. Please revise.
this statement* gives you an output of 12
ReplyDeleteMost excellent, Ryan. 15 XPs awarded for this completion.
ReplyDelete