+ 2

Please how do we change for loop to while loop.

Loops

4th Jul 2018, 3:46 PM
Abdulai Yakubu
Abdulai Yakubu - avatar
3 Answers
+ 3
just edit your code and used for loop instead. int x = 15; int y=0; while (x>=5){ y = y+2; x=x-2; } //....///............///....../// for(int x=15; x>=5; x-2){ y=y+2; }
4th Jul 2018, 4:29 PM
E_E Mopho
E_E Mopho - avatar
+ 3
Thank you all.
5th Jul 2018, 4:14 PM
Abdulai Yakubu
Abdulai Yakubu - avatar
+ 1
You can change this: for(int i = 0; i < 10; i++){ //do something } to: int i = 0; while(i < 10){ //do something i++; }
4th Jul 2018, 4:18 PM
Sad
Sad - avatar