Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@ozuma
Created April 4, 2023 16:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ozuma/a9256d267212226b8beb9d028a40de4a to your computer and use it in GitHub Desktop.
Save ozuma/a9256d267212226b8beb9d028a40de4a to your computer and use it in GitHub Desktop.
ABC294_a: Java, STDIN, stream, Arrays
import java.util.Arrays;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
final int arraySize = Integer.parseInt(sc.next());
int[] lists = new int[arraySize];
for (int i = 0; i < arraySize; i++) {
lists[i] = sc.nextInt();
}
Arrays.stream(lists)
.filter(i -> i % 2 == 0)
.forEach(i -> System.out.println(i));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment