fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. const int MAX_SIZE = 10;
  5.  
  6. int main() {
  7. int size, currentEl, sumMt[MAX_SIZE + 1][MAX_SIZE + 1] = {0};
  8. cin >> size;
  9. for (int mt = 1; mt <= 2; ++mt) {
  10. for (int line = 1; line <= size; ++line) {
  11. for (int col = 1; col <= size; ++col) {
  12. cin >> currentEl;
  13. sumMt[line][col] += currentEl;
  14. if (mt == 2) {
  15. cout << sumMt[line][col] << " ";
  16. }
  17. }
  18. if (mt == 2) {
  19. cout << "\n";
  20. }
  21. }
  22. }
  23.  
  24. return 0;
  25. }
Success #stdin #stdout 0s 5284KB
stdin
4
1 8 12 11
11 18 2 7
6 10 7 18
14 5 16 8
-5 -4 -6 -17
5 2 9 4
7 12 8 9
-19 12 7 -19
	 
-4 4 6 -6
16 20 11 11
13 22 15 27
-5 17 23 -11
stdout
-4 4 6 -6 
16 20 11 11 
13 22 15 27 
-5 17 23 -11