Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- #include<stdio.h>
- #include<math.h>
- #include<stdlib.h>
- using namespace std;
- int main() {
- //maatrice A
- double matrice [3][3]={{1,1,-1},{1,-2,3},{2,3,1}};
- int m=3;
- int n=3;
- //matrice b
- double matrice2 [3][1]= {{4.6923},{-0.7692},{-0.0769}};
- int p=3;
- int q=1;
- double somme=0;
- //matrice final
- double matrice3[3][3];
- int c, d, k;
- if(n !=p) {
- cout << "matrice incompatible" << endl;
- } else {
- for(c=0;c<m;c++) {
- for(d=0;d<q;d++) {
- for(k=0;k<p;k++) {
- somme=somme+matrice[c][k]*matrice2[k][d];
- }
- matrice3[c][d]=somme;
- somme=0;
- }
- }
- }
- for(c=0;c<m;c++) {
- for (d=0;d<q;d++) {
- cout << matrice3[c][d] << "\t" << endl;
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement