006-005-003
Continue Statement: Display Even Numbers Only
Easy
Problem Description
Continue Statement: Display Even Numbers Only
Learning Objective: Skip part of loop with continue statement
Create program that inputs number sequence and displays only even numbers. Use continue statement to skip displaying odd numbers.
Input
Line 1: Number count (integer)
Line 2 onwards: Numbers (integer, multiple lines)
Output
[even1]
[even2]
...
```java
(display only even numbers).
Test Cases
※ Output examples follow programming industry standards
Input:
5 1 2 3 4 5
Expected Output:
2 4
Input:
3 10 20 30
Expected Output:
10 20 30
Input:
3 1 3 5
Expected Output:
❌ Some tests failed
Your Solution
Current Mode:● My Code
99
1
2
3
4
5
6
7
8
9
10
›
⌄
⌄
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
// Write your code here
sc.close();
}
}
0 B / 5 MB
You have 9 free executions remaining
