+ 2
Have a matrix NxM, manual inputting, need a FOR loop to calc each N(row) and M(column) sumary
cant find the code to calc it, pleaae help
3 Answers
0
int a[10][10];
for(int i=0;i<N ;i++)
for(int j=0;j<M;j++)
cin>>a[i][j];
int sum=0;
for(int i=0;i<N ;i++)
for(int j=0;j<M;j++)
sum+=a[i][j];
cout<<sum;
- 1
hey csaba check out my code for matrix row col addition , done as told
- 1
also included automatic random input for matrix from 0 to 10, and a separate function to pass matrix as argument, in case you want to deploy additional operations