C Program for EVEN & ODD NO IN ANY MATRICES
#include stdio.h>
#include conio.h>
void main()
{
int a[100][100];
int i=0,j=0,r,c,even=0,odd=0;
clrscr();
for(i=0;i<100;i++)
{
for(j=0;j<100;j++)
a[i][j]=0;
}
i=0; j=0;
printf("\nENTER THE NO OF ROWS: ");
scanf("%d",&r);
printf("\nENTER THE NO OF COLS: ");
scanf("%d",&c);
for(i=0;i
{
for(j=0;j
{
printf("\nENTER THE ELEMENTS: ");
scanf("%d",&a[i][j]);
}
}
for(i=0;i
{
for(j=0;j
{
printf("%d ",a[i][j]);
if(a[i][j]%2==0)
even++;
else
odd++;
}
printf("\n");
}
printf("\nTHE EVEN NO ARE %d",even);
printf("\nTHE ODD NO ARE %d",odd);
getch();
}
OUTPUT :
ENTER THE NO OF ROWS : 2
ENTER THE NO OF COLS : 2
ENTER THE ELEMENTS : 1
ENTER THE ELEMENTS : 5
ENTER THE ELEMENTS : 3
ENTER THE ELEMENTS : 4
1 5
3 4
THE EVEN NO ARE: 1
THE ODD NO ARE: 3