Subject:
Computer ScienceAuthor:
gavin57Created:
1 year agoAnswer:
#include <iostream>
using namespace std;
#define MAX 50
int main() {
int mat[MAX][MAX];
int m,n,i,j;
cout<<"\nEnter the number of rows and columns: ";
cin>>m>>n;
for(i=0;i<m;i++)
{
cout<<"\nEnter elements of row "<<i+1<<": ";
for(j=0;j<n;j++)
{
cin>>mat[i][j];
}
}
for(i=0;i<m;i++)
{
for(j=0;j<n;j++)
{
if(mat[i][j]==1)
{
for(j=0;j<n;j++)
mat[i][j]=1;
}
}
}
cout<<"\nModified matrix is: "<<endl;
for(i=0;i<m;i++)
{
for(j=0;j<n;j++)
{
cout<<mat[i][j];
}
cout<<endl;
}
return 0;
}
Explanation:
#SPJ3
Author:
thaddeusl1q5
Rate an answer:
8