#include<stdio.h>
int main()
{
int i, j, row, column, count = 0;
printf("Enter Row and Column Number : ");
scanf("%d %d", &row, &column);
int anik[row][column];
printf("\nEnter Element for Matrix : \n");
for(i=0; i<row; i++)
{
for(j=0; j<column; j++)
{
scanf("%d", &anik[i][j]);
}
}
printf("\nColumn containing all 1s : \n");
for(i=0; i<column; i++)
{
count = 0;
for(j=0; j<row; j++)
{
if(anik[j][i] == 1)
{
count++;
}
}
if(count == row)
{
printf("Column no. %d\n", i+1);
}
}
return 0;
}
int main()
{
int i, j, row, column, count = 0;
printf("Enter Row and Column Number : ");
scanf("%d %d", &row, &column);
int anik[row][column];
printf("\nEnter Element for Matrix : \n");
for(i=0; i<row; i++)
{
for(j=0; j<column; j++)
{
scanf("%d", &anik[i][j]);
}
}
printf("\nColumn containing all 1s : \n");
for(i=0; i<column; i++)
{
count = 0;
for(j=0; j<row; j++)
{
if(anik[j][i] == 1)
{
count++;
}
}
if(count == row)
{
printf("Column no. %d\n", i+1);
}
}
return 0;
}
Comments
Post a Comment