Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 3

#include<iostream>

#define Nmaks 10

typedef int matrik[Nmaks][Nmaks];

int main()

matrik A,B,C;

int i,j;

cout<<"Masukkan Nilai-Nilai Matrik A : "<<endl;

for(i=1;i<=2;i++)

for(j=1;j<=3;j++)

cout<<"A["<<i<<","<<j<<"]=";

cin>>A[i][j];

cout<<""<<endl;

cout<<"Masukkan nilai-nilai matrik B : "<<endl;

for (i=1;i<=3;i++)

for(j=1;j<=2;j++)

cout<<"A["<<i<<","<<j<<"]=";

cin>>B[i][j];

cout<<""<<endl;

cout<<"isi matrik A : "<<endl;

for(i=1;i<=2;i++)

for(j=1;j<=3;j++)

cout<<" "<<A[i][j];
}

cout<<""<<endl;

cout<<""<<endl;

cout<<"Isi matrik B : "<<endl;

for(i=1;i<=3;i++)

for(j=1;j<=2;j++)

cout<<""<<B[i][j];

cout<<""<<endl;

for(i=1;i<=2;i++)

for(j=1;j<=2;j++)

C[i][j]=(A[i][1]*B[1][j]+A[i][2]*B[2][j]+A[i][3]*B[3][j]);

cout<<""<<endl;

cout<<"isi matrik C=AxB : "<<endl;

for(i=1;i<=2;i++)

for(j=1;j<=2;j++)

cout<<C[i][j];

cout<<""<<endl;

}
}

You might also like