Advertisement
Garey

Matrix

Nov 7th, 2017
243
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main()
  5. {
  6.     int mat[2][3];
  7.     int sum[3];
  8.     int i, j;
  9.     for (i = 0; i < 2; i++) {
  10.         for (j = 0; j < 3; j++) {
  11.             cout << "mat[" << i << "][" << j << "]=";
  12.             cin >> mat[i][j];
  13.         }
  14.     }
  15.     for (i = 0; i < 2; i++) {
  16.         for (j = 0; j < 3; j++) {
  17.             cout << mat[i][j] << "   ";
  18.         }
  19.         cout << endl;
  20.     }
  21.  
  22.     for (j = 0; j < 3; j++) {
  23.         sum[j] = 0;
  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. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement