31st Aug 2020, 5:34 PM
Mr. 12
Mr. 12 - avatar
6 ответов
+ 1
Because you write: i > 0 But this will not print 0 because (i) is greater than 0 For solving this problem just add: i >= 0 Now (i) is equal or greater than 0 and it will print 0 too.
31st Aug 2020, 5:49 PM
Alireza
+ 1
I working like this I=4>0; Print 4 //in result now I= 2 I=2>0 Print 2 //in result Now I=0 I=0 not >0 Hence no print.//in result hope I clear my view to u.
31st Aug 2020, 6:03 PM
Divya Mohan
Divya Mohan - avatar
0
Because condition is I>0 Use I >= 0 to get 0 also
31st Aug 2020, 5:46 PM
Divya Mohan
Divya Mohan - avatar
0
Divya Mohan but, when i = 2, 2 > 0, so i = 2-2 so i becomes 0 then i = 0, 0>0 (false) so it wont go for 3rd condition. but i value still remains 0 right ?
31st Aug 2020, 5:49 PM
Mr. 12
Mr. 12 - avatar
0
so it will push the value to the array only if second condition is true?
31st Aug 2020, 5:57 PM
Mr. 12
Mr. 12 - avatar