Q. int[] numbers = { 10, 20, 30, 40, 50 }; 이와 같이 주어진 숫자 배열에서 최대값과 최소값을 찾는 프로그램을 작성하세요.
- Console.WriteLine(); 을 사용해 최대값과 최소값을 각각 출력할 수 있습니다.
int[] numbers = {10, 20, 30, 40, 50};
int max = numbers.Max();
int min = numbers.Min();
Console.WriteLine("Max: {0}, Min: {1}", max, min);