Advertisement
Spocoman

07. Min Number

Aug 28th, 2024
43
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.48 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class MinNumber {
  4.     public static void main(String[] args) {
  5.         Scanner scanner = new Scanner(System.in);
  6.         String input = scanner.nextLine();
  7.         int minNum = 1000000000;
  8.  
  9.         while (!input.equals("Stop")) {
  10.             int n = Integer.parseInt(input);
  11.             if (n < minNum) {
  12.                minNum  = n;
  13.             }
  14.             input = scanner.nextLine();
  15.         }
  16.  
  17.         System.out.println(minNum);
  18.     }
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement