Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Main {
- public static void main (String[] args) {
- Scanner sc = new Scanner(System.in);
- String input;
- input = sc.next();
- int min = Integer.MAX_VALUE;
- int max = Integer.MIN_VALUE;
- while (!input.equalsIgnoreCase("Stop")) {
- int x = Integer.valueOf(input);
- if (x < min)
- min = x;
- if (x > max)
- max = x;
- input = sc.next();
- }
- System.out.println(min);
- System.out.println(max);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement