I can not find WHY? output is 0123456789? instead of odd numbers 13579? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

I can not find WHY? output is 0123456789? instead of odd numbers 13579?

https://code.sololearn.com/wop3D19BTpY1/?ref=app <?php for($i=0; $i<10; $i++) { if ($i%2==10){ continue; } echo $i. ’’; } ?>

2nd Mar 2018, 4:11 PM
Jan Sunshine53
Jan Sunshine53 - avatar
4 Answers
+ 3
https://code.sololearn.com/w9k79g83qVU1/#php CHANGE: if ($i%2==10) TO: if ($i%2==0) The problem is that you're seeing if the remainder equals 10, rather than 0. If you change it to 0, then if it's even it'll return 0 and you can continue with next iteration. If it's odd number, it'll return 1.
2nd Mar 2018, 4:15 PM
Fata1 Err0r
Fata1 Err0r - avatar
+ 3
Oh Yes👍!! Thank You ;>) I understand what had happened when I corrected it.
2nd Mar 2018, 4:26 PM
Jan Sunshine53
Jan Sunshine53 - avatar
+ 3
You're more than welcome, Jan! Best of luck to you with your learning.
2nd Mar 2018, 4:57 PM
Fata1 Err0r
Fata1 Err0r - avatar
+ 1
😂😂😂😂sweet mistake...
2nd Mar 2018, 6:52 PM
sayan chandra
sayan chandra - avatar