백준알고리즘 6단계 1차원배열_java 작성일 2020-01-09 | In Algorithm 10818번_최대최소_step01 12345678910111213141516171819202122232425import java.util.*; public class Main{ public static void main(String[] args){ Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int[] arr = new int[n]; int max=-1000000; int min=1000000; for(int i=0;i<n;i++) { arr[i] = sc.nextInt(); if(max < arr[i]) { max = arr[i]; } if(min > arr[i]) { min = arr[i]; } } System.out.println(min+" "+max); } } 2562번_최댓값_step02 12345678910111213141516171819202122import java.util.*; public class Main{ public static void main(String[] args){ Scanner sc = new Scanner(System.in); int[] arr=new int[9]; int max=0, index=0; for(int i=0;i<9;i++) { arr[i]=sc.nextInt(); if(arr[i]>max){ max = arr[i]; index = i; } } System.out.println(max); System.out.println(index+1); } } 2577번_숫자의 개수_step03 1