Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class MaxNumber {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- int numbers = Integer.parseInt(scanner.nextLine());
- int maxNum = Integer.parseInt(scanner.nextLine());
- for (int i = 1; i < numbers; i++) {
- int currentNum = Integer.parseInt(scanner.nextLine());
- if(currentNum > maxNum){
- maxNum = currentNum;
- }
- }
- System.out.println(maxNum);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment