Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const int N = 3;
- int a[N][N], b[N][N], c[N][N], s;
- for (int i = 0; i<N; i++)
- {
- for (int j = 0; j<N; j++)
- {
- a[i][j] = rand() % 10;
- cout << a[i][j] << '\t';
- }
- cout << endl;
- }
- cout << endl;
- for (int i = 0; i<N; i++)
- {
- for (int j = 0; j<N; j++)
- {
- b[i][j] = rand() % 10;
- cout << b[i][j] << '\t';
- }
- cout << endl;
- }
- cout << endl;
- for (int i = 0; i<N; i++)
- {
- for (int l = 0; l<N; l++)
- {
- s = 0;
- for (int j = 0; j<N; j++)
- {
- s += a[i][j] * b[j][l];
- }
- c[i][l] = s;
- cout << c[i][l] << '\t';
- }
- cout << endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement