Problem of the Day
Friday, October 24, 2025
Problem:
Which of the following loops will print out the numbers 1-11, inclusive?
int i = 1;
while (i < 12)
{
System.out.println(i);
i++;
}int i = 1;
while (i <= 11)
{
System.out.println(i);
i++;
}int i = 0;
while (i < 11)
{
i++;
System.out.println(i);
}
- I only
- I and II only
- I and III only
- I, II, and II
The correct answer is d. All of them produce the required output, although loop I is the most common form.