23.1.23010670. Pomnožiti matricu dimenzija 4x6 sa matricom dimenzija 6x3.
Opis rješenja:
Listing programa:
/* 23010670 Pomnožiti matricu dimenzija 4x6 sa matricom dimenzija 6x3 */
#include <cstdlib>
#include <iostream>
using namespace std;
int main()
{int a[4][6]={1,1,1,1,1,1,
2,2,2,2,2,2,
3,3,3,3,3,3,
4,4,4,4,4,4},
b[6][3]={1,1,1,
2,2,2,
3,3,3,
4,4,4,
5,5,5,
6,6,6}, p[4][3]={0};
for (int i=0; i<4; i++)
{for (int j=0; j<3; j++)
{for (int k=0; k<6; k++)
p[i][j]=p[i][j]+a[i][k]*b[k][j];
cout << p[i][j] << " ";
}
cout << endl;
}
system("PAUSE");
return EXIT_SUCCESS;
}
Ispis na ekranu:
Riješeni zadaci Index
|
|