It's very hard for me. I don't know how make that option when user don't write any even numbers. How to tell program if any x don't have x % 2 != 0 ?
package en.codegym.task.pro.task04.task0408;
import java.util.Scanner;
/*
Maximum of entered numbers
8
9
8
4
5
e
*/
public class Solution {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int max = 0;
if (scanner.hasNextInt()) {
while (scanner.hasNextInt()) {
int x = scanner.nextInt();
if (x % 2 == 0) {
if (x > max)
max = x;
}
}
System.out.println(max);
}else if (!scanner.hasNextInt()) {
System.out.println(Integer.MIN_VALUE);
}
}
}