๋ฐ์ํ
import java.util.Scanner;
public class Main {
// 2562 ์ต๋๊ฐ
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int max = 0;
int maxIndex = 0;
int[] numArr = new int[9];
for (int i=0; i<numArr.length; i++) {
numArr[i] = sc.nextInt();
if (max < numArr[i]) {
max = numArr[i];
maxIndex = i+1;
}
}
sc.close();
System.out.println(max);
System.out.println(maxIndex);
}
}
๋ฐ์ํ
'๐ธ Algorithm > ๐ธ ๋ฐฑ์ค BaekJoon' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[๋ฐฑ์ค][java][10813][๊ณต ๋ฐ๊พธ๊ธฐ] (0) | 2023.11.05 |
---|---|
[๋ฐฑ์ค][java][10810][๊ณต ๋ฃ๊ธฐ] (1) | 2023.10.22 |
[๋ฐฑ์ค][java][10818][์ต์, ์ต๋] (0) | 2023.10.15 |
[๋ฐฑ์ค][java][10871][X๋ณด๋ค ์์ ์] (0) | 2023.10.15 |
[๋ฐฑ์ค][java][10807][๊ฐ์ ์ธ๊ธฐ] (0) | 2023.10.15 |