문제
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int count = scan.nextInt();
int scanNum = 0, num = 0, min = 0, max = 0;
while(num < count){
scanNum = scan.nextInt();
if(num == 0){
min = scanNum;
max = scanNum;
}else{
if(min > scanNum){
min = scanNum;
}else if(max < scanNum){
max = scanNum;
}
}
num++;
}
System.out.println(min * max);
}
}
'코딩 문제 > 백준' 카테고리의 다른 글
백준 - 1074번 (0) | 2021.03.15 |
---|---|
백준 - 1059번 (0) | 2021.03.15 |
백준 - 1018번 (0) | 2021.03.15 |
백준 - 1010번 (0) | 2021.02.26 |
백준 - 1009번 (0) | 2021.02.26 |