Advertisement
yovkovbpfps

While Loop Min Number

Apr 3rd, 2019
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class minNum {
  4. public static void main(String[] args) {
  5. Scanner scanner = new Scanner(System.in);
  6.  
  7. int n = Integer.parseInt(scanner.nextLine());
  8. int min = Integer.MAX_VALUE;
  9.  
  10. while (n --> 0) {
  11. int num = Integer.parseInt(scanner.nextLine());
  12. if (num < min) {
  13. min = num;
  14. }
  15. }
  16. System.out.println(min);
  17. }
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement