Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class E05maxNumber {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- System.out.print("n = ");
- int n = scanner.nextInt();
- System.out.print("Enter the numbers: ");
- int max = Integer.MIN_VALUE;
- for (int i = 0; i < n; i++) {
- int num = scanner.nextInt();
- if (num > max) {
- max = num;
- }
- }
- System.out.printf("%d", max);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment