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