+ 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

11th Dec 2016, 1:14 PM
Csaba Matyas Langer
Csaba Matyas Langer - avatar
3 Respuestas
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;
11th Dec 2016, 1:40 PM
manish rawat
manish rawat - avatar
- 1
hey csaba check out my code for matrix row col addition , done as told
11th Dec 2016, 1:35 PM
Morpheus
Morpheus - avatar
- 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
11th Dec 2016, 2:52 PM
Morpheus
Morpheus - avatar