+ 1

How sum += i , right answer 16?

i = 8, sum = 0

15th Dec 2020, 6:41 PM
KRAX
KRAX - avatar
6 Respuestas
+ 3
If you iterate that statement twice, sum will be 16.
15th Dec 2020, 9:43 PM
Sonic
Sonic - avatar
+ 2
Please post the complete code, otherwise nobody can know what you are talking about
15th Dec 2020, 6:46 PM
Benjamin Jürgens
Benjamin Jürgens - avatar
+ 1
if sum += i happens, sum will be 8
15th Dec 2020, 7:17 PM
Gizmo-Lang
Gizmo-Lang - avatar
+ 1
No, if you did that you would have -8
15th Dec 2020, 9:25 PM
Gizmo-Lang
Gizmo-Lang - avatar
0
If answer is 16 then you have to put - sign at place of +
15th Dec 2020, 8:46 PM
Ravindra Pratap Maurya
0
did they say you were supposed to loop twice?
15th Dec 2020, 9:47 PM
Gizmo-Lang
Gizmo-Lang - avatar