Advertisement
Rock96

drdrdrdr

Dec 22nd, 2014
252
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.60 KB | None | 0 0
  1. const int N = 3;
  2.     int a[N][N], b[N][N], c[N][N], s;
  3.  
  4.     for (int i = 0; i<N; i++)
  5.     {
  6.         for (int j = 0; j<N; j++)
  7.         {
  8.             a[i][j] = rand() % 10;
  9.             cout << a[i][j] << '\t';
  10.         }
  11.         cout << endl;
  12.     }
  13.  
  14.     cout << endl;
  15.  
  16.     for (int i = 0; i<N; i++)
  17.     {
  18.         for (int j = 0; j<N; j++)
  19.         {
  20.             b[i][j] = rand() % 10;
  21.             cout << b[i][j] << '\t';
  22.         }
  23.         cout << endl;
  24.     }
  25.  
  26.     cout << endl;
  27.  
  28.     for (int i = 0; i<N; i++)
  29.     {
  30.         for (int l = 0; l<N; l++)
  31.         {
  32.             s = 0;
  33.             for (int j = 0; j<N; j++)
  34.             {
  35.                 s += a[i][j] * b[j][l];
  36.             }
  37.             c[i][l] = s;
  38.             cout << c[i][l] << '\t';
  39.         }
  40.         cout << endl;
  41.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement