Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package whileLoops;
- import java.util.Scanner;
- public class P07MinNumber {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- String input = scanner.nextLine();
- int minNum = Integer.MAX_VALUE;
- while (!input.equals("Stop")) {
- int currentNum = Integer.parseInt(input);
- if (currentNum < minNum) {
- minNum = currentNum;
- }
- input = scanner.nextLine();
- }
- System.out.println(minNum);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement