SHOW:
|
|
- or go back to the newest paste.
1 | #include <iostream> | |
2 | using namespace std; | |
3 | ||
4 | int main() | |
5 | { | |
6 | int mat[2][3]; | |
7 | - | int sum [3]; |
7 | + | int sum[3]; |
8 | int i, j; | |
9 | - | for (i = 0; i < 2; i++){ |
9 | + | for (i = 0; i < 2; i++) { |
10 | - | for (j = 0; j < 3; j++){ |
10 | + | |
11 | cout << "mat[" << i << "][" << j << "]="; | |
12 | cin >> mat[i][j]; | |
13 | } | |
14 | } | |
15 | for (i = 0; i < 2; i++) { | |
16 | - | sum[j] = 0; |
16 | + | |
17 | - | for (i = 0; i < 2; i++){ |
17 | + | cout << mat[i][j] << " "; |
18 | - | cout << mat[i][j] << " "; |
18 | + | |
19 | - | sum[j] = sum[j] + mat[i][j]; |
19 | + | cout << endl; |
20 | - | } |
20 | + | |
21 | - | cout << endl; |
21 | + | |
22 | for (j = 0; j < 3; j++) { | |
23 | - | for (j = 0; j < 3; j++) |
23 | + | sum[j] = 0; |
24 | - | cout << "sumata ot koloni " << j << " e " << sum[j] << endl; |
24 | + | for (i = 0; i < 2; i++) |
25 | sum[j] = sum[j] + mat[i][j]; | |
26 | } | |
27 | for (j = 0; j < 3; j++) | |
28 | cout << "sumata ot koloni " << j << " e " << sum[j] << endl; | |
29 | ||
30 | system("pause"); | |
31 | return 0; | |
32 | } |