+ 5
What happens in line 2? [Solved]
5 Respuestas
+ 3
[Solved]
+ 1
When the value of i is odd,it satisfies the if condition and prints the value of i+1
+ 1
If the remainder after dividing i by 2 is not zero,it prints i+1
0
Line 2
The code in this line tests
if i
is not
divisible by 2
without remainder.
But:
Line 3
It adds 1 to i and returns the result (which means, the result on console is divisible by 2 without remainder)
Without the "+1" the code would print the results of line 2.
I hope this help.