Advertisement
veronikaaa86

07. Min Number

Mar 26th, 2022
200
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. package whileLoops;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class P07MinNumber {
  6. public static void main(String[] args) {
  7. Scanner scanner = new Scanner(System.in);
  8.  
  9. String input = scanner.nextLine();
  10.  
  11. int minNum = Integer.MAX_VALUE;
  12. while (!input.equals("Stop")) {
  13. int currentNum = Integer.parseInt(input);
  14.  
  15. if (currentNum < minNum) {
  16. minNum = currentNum;
  17. }
  18.  
  19. input = scanner.nextLine();
  20. }
  21.  
  22. System.out.println(minNum);
  23. }
  24. }
  25.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement