정수 배열에서 홀수와 짝수의 갯수를 출력하고 싶을 때, int[] arr = new int[] { 3, 5, 4, 2, 6, 4, 6, 8, 54, 23, 4, 6, 4 }; Console.WriteLine($"짝수의 갯수 : {Count(arr, IsEvne)}"); Console.WriteLine($"홀수의 갯수 : {Count(arr, IsOdd)}"); 이것을 구분하기 위해 홀과 짝을 구분하는 메서드 를 만들어서 구분할 수 있다. static int EvenCount(int[] a) // 짝수 { int cnt = 0; foreach (var n in a) { if (n%2==0) { cnt++; } } return cnt; } static int OddCount(int[] a) //홀수 { in..