+ 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.
3 odpowiedzi
+ 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
+ 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. 😎😎
0
great!!
thanks :)