public class Solution {
public static void main(String[] args) throws IOException {
Scanner sc1 = new Scanner(System.in);
int[] newarray = new int[20];
for(int x = 0; x<20; x++) {
int n = sc1.nextInt();
newarray[x] = n;
}
int r = newarray[0];
int t = newarray[0];
int maximum;
int minimum;
for(int x = 0; x<newarray.length-1; x++){
if(r < newarray[x]){
r = newarray[x];
}
}
for(int x = 0; x<newarray.length-1; x++) {
if(t > newarray[x]) {
t = newarray[x];
}
}
maximum = r;
minimum = t;
System.out.print(maximum + " " + minimum);
}
}

package com.codegym.task.task07.task0721;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Scanner;
/*
Min and max in arrays
*/
public class Solution {
public static void main(String[] args) throws IOException {
Scanner sc1 = new Scanner(System.in);
int[] newarray = new int[20];
for(int x = 0; x<20; x++) {
int n = sc1.nextInt();
newarray[x] = n;
}
int r = newarray[0];
int t = newarray[0];
int maximum;
int minimum;
for(int x = 0; x<newarray.length-1; x++){
if(r > newarray[x]){
r = newarray[x];
}
}
for(int x = 0; x<newarray.length-1; x++) {
if(t < newarray[x]) {
t = newarray[x];
}
}
maximum = r;
minimum = t;
System.out.print(maximum + " " + minimum);
}
}