Computer Science, asked by Naveel9748, 1 year ago

Write a colsum() in c++ to find sum of each column of n×m matrix

Answers

Answered by varshneysamyakoxg8tj
0
void colsum(int A[][4],int M,int N)
{
int i,j,s;

for(i=0;i<N;i++) //N is number of columns of 2d matrix
{
s=0;

    for(j=0;j<M;j++) //M is number of rows of 2d matrix
     
{
s=s+A[i][j];
    }
cout<<"sum of col "<<i+1<<" is "<<s<<endl;


}
}
Similar questions