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];
  8. cin >> size;
  9. for (int line = 1; line <= size; ++line) {
  10. for (int col = 1; col <= size; ++col) {
  11. cin >> currentEl;
  12. sumMt[line][col] = currentEl;
  13. }
  14. }
  15. for (int line = 1; line <= size; ++line) {
  16. for (int col = 1; col <= size; ++col) {
  17. cin >> currentEl;
  18. cout << (sumMt[line][col] += currentEl) << " ";
  19. }
  20. cout << "\n";
  21. }
  22. return 0;
  23. }
Success #stdin #stdout 0.01s 5288KB
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