Anyone to make me understand this code :) | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Anyone to make me understand this code :)

https://drive.google.com/file/d/0B-YZWXC5_VTxVHVINXBrZnZwR3c/view?usp=drivesdk Little bit confused with the output, I got this during a challenge.

11th Aug 2017, 1:36 PM
Rupak Chowdhury
Rupak Chowdhury - avatar
3 Answers
+ 9
Iterations: i=1, j=0; i+j>4 = 1>4: false. Prints 1*0 = 0 i=1, j=1; i+j>4 = 2>4: false. Prints 1*1 = 1 i=1, j=2; i+j>4 = 3>4: false. Prints 1*2 = 2 i=3, j=0; i+j>4 = 3>4: false. // note: i+=2 Prints 3*0 = 0 i=3, j=1; i+j>4 = 4>4: false. Prints 3*1 = 3 i=3, j=2; i+j>4 = 5>4: true. Breaks the loop
11th Aug 2017, 2:34 PM
Shamima Yasmin
Shamima Yasmin - avatar
+ 2
The best way to understand any code is to use "Step over" from the debug menu in your favourite IDE or even on notepad++.Try it out and you will understand what you didn't understand. 😎😎
11th Aug 2017, 3:53 PM
Julian Aung
Julian Aung - avatar
0
great!! thanks :)
11th Aug 2017, 3:55 PM
Rupak Chowdhury
Rupak Chowdhury - avatar