Q. What is the output of the following code?
Code:
for (int i = 1; i <= 10; i++) {
if (i % 2 == 0) {
continue;
}
System.out.println(i);
}
β
Correct Answer: (A)
1 3 5 7 9
Explanation: The for loop iterates from 1 to 10, skipping any even numbers using the continue statement. The odd numbers are printed to the console.