Advertisement
YavorGrancharov

MaxNumber

Jan 23rd, 2017
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.51 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class MaxNumber {
  4.     public static void main(String[] args) {
  5.         Scanner console = new Scanner(System.in);
  6.         int n = Integer.parseInt(console.nextLine());
  7.         int max = 0;
  8.         for (int i = 0; i < n; i++) {
  9.             int num = Integer.parseInt(console.nextLine());
  10.             if (num > max) {
  11.                 max = num;
  12.             }
  13.             if (i == 0) {
  14.                 max = num;
  15.             }
  16.         }
  17.         System.out.println(max);
  18.     }
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement