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.

Here is source code of the C program to find the frequency of odd & even numbers in the given matrix. The C program is successfully compiled and run on a Linux system. The program output is also shown below.

`/*`

`* C program to find the frequency of odd numbers`

`* and even numbers in the input of a matrix`

`*/`

`#include <stdio.h>`

void main()

`{`

static int array[10][10];

int i, 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 (i = 0; i < m; ++i)

`{`

for (j = 0; j < n; ++j)

`{`

scanf("%d", &array[i][j]);

if ((array[i][j] % 2) == 0)

`{`

++even;

`}`

`else`

++odd;

`}`

`}`

printf("The given matrix is \n");

for (i = 0; i < m; ++i)

`{`

for (j = 0; j < n; ++j)

`{`

printf(" %d", array[i][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);

`}`

$ cc pgm71.c $ a.out Enter the order ofthe matrix 3 3 Enter the coefficients of matrix 34 36 39 23 57 98 12 39 49 The given matrix is 34 36 39 23 57 98 12 39 49 The frequency of occurance of odd number = 5 The frequency of occurance of even number = 4

**Sanfoundry Global Education & Learning Series – 1000 C Programs.**

Here’s the list of Best Reference Books in C Programming, Data-Structures and Algorithms

If you wish to look at other example programs on Matrix, go to C Programming Examples on Matrix. If you wish to look at programming examples on all topics, go to C Programming Examples.