What happens in line 2? [Solved] | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
10th Sep 2019, 3:01 PM
Alireza Ebrahimi
Alireza Ebrahimi - avatar
4 Answers
+ 3
[Solved]
16th Jun 2020, 7:20 PM
Alireza Ebrahimi
Alireza Ebrahimi - avatar
+ 1
When the value of i is odd,it satisfies the if condition and prints the value of i+1
10th Sep 2019, 3:14 PM
Anurag Singh
Anurag Singh - avatar
+ 1
If the remainder after dividing i by 2 is not zero,it prints i+1
10th Sep 2019, 3:28 PM
Finn
Finn - avatar
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.
10th Sep 2019, 4:40 PM
Sven_m
Sven_m - avatar