Advertisement
Mishakis

MaxNumber

Aug 2nd, 2017
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.67 KB | None | 0 0
  1. package com.company;
  2.  
  3. import com.sun.org.apache.xpath.internal.SourceTree;
  4.  
  5. import java.time.chrono.MinguoEra;
  6. import java.util.Scanner;
  7.  
  8. public class Main {
  9.  
  10.     public static void main(String[] args) {
  11.         Scanner scanner = new Scanner(System.in);
  12.  
  13.         int n = Integer.parseInt(scanner.nextLine());
  14.         int max= Integer.MIN_VALUE;
  15.  
  16.         for (int i = 0; i <n ; i++) {
  17.             int a = Integer.parseInt(scanner.nextLine());
  18.                 if(a>max){
  19.                     max = a;
  20.                     System.out.println(max);
  21.                 }else{
  22.                     System.out.println(max);
  23.                 }
  24.                
  25.         }
  26.  
  27.     }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement