utpal
int M[1000][1000], row, col ;
cout << "Enter row :";
cin>>row;
cout <<endl << "Enter col :";
cin>>col;
for (int i = 0; i < row; i++)
for (int j = 0; j < col; j++)
cin >> M[i][j];
int count, temp;
count = 0;
temp = 0;
for (int i=0; i<=row; i++)
{
count = 0;
for(int j=0; j<=col; j++)
{
if(M[i][j] == 1)
{
count++;
}
}
if(count > col/2)
{
cout << "Row no" << i + 1;
temp = count;
}
}
int M[1000][1000], row, col ;
- utpal January 25, 2015cout << "Enter row :";
cin>>row;
cout <<endl << "Enter col :";
cin>>col;
for (int i = 0; i < row; i++)
for (int j = 0; j < col; j++)
cin >> M[i][j];
int count;
count = 0;
for (int i=0; i<=row; i++)
{
count = 0;
for(int j=0; j<=col; j++)
{
if(M[i][j] == 1)
{
count++;
}
}
if(count > col/2)
{
cout << "Row no" << i + 1;
}
}