A

Admin • 828.03K Points
Coach

Q. What will be the output?
for (int i = 1; i <= 5; i++) {
if (i % 2 == 0) continue;
System.out.print(i);
}

  • (A) 12345
  • (B) 135
  • (C) 24
  • (D) 54321
  • Correct Answer - Option(B)
  • Views: 10
  • Filed under category Java
  • Hashtags: Java Loops

Explanation by: Admin
continue skips even numbers, so only odd numbers 1, 3, 5 are printed.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.