package com.kook.ch05Project;
public class Ex05_03 {
public static void main(String[] args) {
int[] score = {79, 88, 91, 33, 100, 55, 95};
int max = score[0];
int min = score[0];
for(int i=1; i < score.length; i++) {
if(score[i] > max) {
max = score[i];
} else if(score[i] < min) {
min = score[i];
}
}
System.out.println("최대값 : " + max);
System.out.println("최소값 : " + min);
}
}'Back-End - Main Menu > Java' 카테고리의 다른 글
| Ex05_05 - 배열의활용(4) - 로또 번호 만들기 (0) | 2022.12.27 |
|---|---|
| Ex05_04 - 배열의활용(3) - 섞기(shuffle) (0) | 2022.12.27 |
| Ex05_02 - 배열의 활용(1) - 총합과 평균 (0) | 2022.12.27 |
| Ex04_18 - break문과 continue문 (0) | 2022.12.27 |
| Ex04_19 - 이름 붙은 반복문 (0) | 2022.12.27 |