#include<stdio.h>
int main()
{
int i, j, n, m, count = 0;
printf("Enter row and column number : ");
scanf("%d %d", &n, &m);
int anik[n][m];
for(i=0; i<n; i++)
{
for(j=0; j<m; j++)
{
scanf("%d", &anik[i][j]);
}
}
printf("Number of 2 in each row : \n");
for(i=0;i<n;i++)
{
for(j=0;j<m;j++)
{
if(anik[i][j] == 2)
{
count++;
}
}
printf("row %d : %d",i+1,count);
printf("\n");
count = 0;
}
return 0;
}
int main()
{
int i, j, n, m, count = 0;
printf("Enter row and column number : ");
scanf("%d %d", &n, &m);
int anik[n][m];
for(i=0; i<n; i++)
{
for(j=0; j<m; j++)
{
scanf("%d", &anik[i][j]);
}
}
printf("Number of 2 in each row : \n");
for(i=0;i<n;i++)
{
for(j=0;j<m;j++)
{
if(anik[i][j] == 2)
{
count++;
}
}
printf("row %d : %d",i+1,count);
printf("\n");
count = 0;
}
return 0;
}
Comments
Post a Comment