Advertisement
Vladkoheca

Nai-golqmo i nai-malko chislo.java

Mar 29th, 2024
47
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.58 KB | Source Code | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class Main {
  4.     public static void main (String[] args) {
  5.         Scanner sc = new Scanner(System.in);
  6.  
  7.         String input;
  8.         input = sc.next();
  9.         int min = Integer.MAX_VALUE;
  10.         int max = Integer.MIN_VALUE;
  11.         while (!input.equalsIgnoreCase("Stop")) {
  12.             int x = Integer.valueOf(input);
  13.             if (x < min)
  14.                 min = x;
  15.             if (x > max)
  16.                 max = x;
  17.             input = sc.next();
  18.         }
  19.         System.out.println(min);
  20.         System.out.println(max);
  21.     }
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement