Advertisement
Kathy2905

MaxNumber

Oct 15th, 2018
106
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 MaxNumber {
  4.     public static void main(String[] args) {
  5.         Scanner scanner = new Scanner(System.in);
  6.  
  7.         int n = Integer.parseInt(scanner.nextLine());
  8.         int maxNum = Integer.MIN_VALUE;
  9.  
  10.         for (int i = 0; i < n; i++) {
  11.             int num = Integer.parseInt(scanner.nextLine());
  12.  
  13.             if (num > maxNum) {
  14.                 maxNum = num;
  15.             }
  16.         }
  17.         System.out.println(maxNum);
  18.  
  19.  
  20.     }
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement