UNIFORMITY MATRIX using Function

Description:

Uniformity matrix is a matrix in which all the elements in the matrix are either completely even or completely odd Test Case 1 Input (stdin) 2 4 5 5 4 Expected Output no Test Case 2 Input (stdin) 3 2 4 0 0 6 8 10 12 16 Expected Output yes

Program :

#include <stdio.h>

int main()

{

int arr[100][100];

  int n=0,i,j,cnt=0;

  scanf ("%d",&n);

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

  {

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

    {

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

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

      {

        cnt++;

      }

    }

  }

  if (cnt==n*n||cnt==0){

    printf ("yes");

}

else

{

  printf ("no");

}

return 0;

}