16.5k views
0 votes
Java 1

Question 16
Examine the following code:

int count = 0;
while ( count <= 6 )
{
System.out.print( count + " " );
count = count + 3;
}
System.out.println( );

What does this code print on the monitor?

a. 1 2 3 4 5 6
b. 0 1 2 3 4 5 6
c. 0 3 6
d. 0 1 2 3 4 5
e. 0 3

User Jackieyang
by
5.7k points

1 Answer

2 votes

Answer:

the answer is c.036

Explanation:

it can't be a, b or d because count is being increased by 3 and not 1. And it can't be e because the loop is <= and not < so when the count is 6 it is still in the loop. So it will show the 6 as well

User Squeez
by
5.1k points