C Programming Code Examples C > Arrays and Matrices Code Examples Find the Frequency of Odd & Even Numbers in the given Matrix Find the Frequency of Odd & Even Numbers in the given Matrix This C Program finds frequency of odd & even numbers in the given matrix. The program first accepts the matrix. Then finds the odd and even numbers in a matrix. Then finds the occurrence of odd and even numbers in a given matrix. #include <stdio.h> void main() { static int array[8][8]; int x, j, m, n, even = 0, odd = 0; printf("Enter the order ofthe matrix \n"); scanf("%d %d", &m, &n); printf("Enter the coefficients of matrix \n"); for (x = 0; x < m; ++x) { for (j = 0; j < n; ++j) { scanf("%d", &array[x][j]); if ((array[x][j] % 2) == 0) { ++even; } else ++odd; } } printf("The given matrix is \n"); for (x = 0; x < m; ++x) { for (j = 0; j < n; ++j) { printf(" %d", array[x][j]); } printf("\n"); } printf("\n The frequency of occurance of odd number = %d \n", odd); printf("The frequency of occurance of even number = %d\n", even); }