about summary refs log tree commit diff
path: root/usth/ICT2.2/labwork/4/MaxMin.java
blob: d34c01f2ccd5bc7912c8b6656eb8bf78ebd534b2 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import java.util.ArrayList;
import java.util.Scanner;

import static java.util.Collections.min;
import static java.util.Collections.max;
import static java.util.stream.Collectors.toList;

class MaxMin
{
  public static void main(String... args)
  {
    var numbers = new ArrayList<Integer>();
    var scanner = new Scanner(System.in);
    while (scanner.hasNextInt())
      numbers.add(scanner.nextInt());
    System.out.printf("Min: %d\nMax: %d\n", min(numbers), max(numbers));
  }
}