package com.javarush.task.pro.task04.task0410;
import java.util.Scanner;
/*
Второе минимальное число из введенных
*/
public class Solution {
public static void main(String[] args) {
//напишите тут ваш код
Scanner console = new Scanner(System.in);
int min1 = Integer.MAX_VALUE;
int min2 = Integer.MAX_VALUE;
while (console.hasNextInt()) {
int x = console.nextInt();
if ((min1 > x) && ((x % 2) == 1)) {
min1 = x;
}
else if ((min2 > x) && ((x % 2) == 0)) {
min2 = x;
}
}
if (min1 > min2) {
System.out.println(min1);
}
else {
System.out.println(min2);
}
}
}
package com.javarush.task.pro.task04.task0410;
import java.util.Scanner;
/*
Второе минимальное число из введенных
*/
public class Solution {
public static void main(String[] args) {
//напишите тут ваш код
Scanner console = new Scanner(System.in);
int min1 = Integer.MAX_VALUE;
int min2 = Integer.MAX_VALUE;
while (console.hasNextInt()) {
int x = console.nextInt();
if ((min1 > x) && ((x % 2) == 1)) {
min1 = x;
}
else if ((min2 > x) && ((x % 2) == 0)) {
min2 = x;
}
}
if (min1 > min2) {
System.out.println(min1);
}
else {
System.out.println(min2);
}
}
}