72.9k views
4 votes
Demonstrate the condition of a while loop that runs no more than five times using the variable x, which is initialized at x = 1.

User Benn
by
5.5k points

1 Answer

4 votes

Answer:

Python Code:

x = 1

while x <= 5:

# do something

x += 1 # then incriment

Java Code:

int x = 1;

do {

System.out.println(i);

x++;

}

while (x <= 5);

User Mahmoud Ayman
by
5.6k points