+ 2
Please how do we change for loop to while loop.
Loops
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;
}
+ 3
Thank you all.
+ 1
You can change this:
for(int i = 0; i < 10; i++){
//do something
}
to:
int i = 0;
while(i < 10){
//do something
i++;
}