Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream.h>
- #include <conio.h>
- void main()
- {
- int b,k,s;
- int A[5][5],B[5][5],C[5][5];
- //Matriks A
- for(b=0;b<3;b++)
- {
- for(k=0;k<3;k++)
- {
- cout<<" Matiks A Baris " <<(b+1)<<"."<<(k+1)<<" : ";
- cin>>A[b][k];
- } cout<<endl;
- }cout<<endl;
- //Matriks B
- for(b=0;b<3;b++)
- {
- for(k=0;k<3;k++)
- {
- cout<<" Matiks B Baris " <<(b+1)<<"."<<(k+1)<<" : ";
- cin>>B[b][k];
- } cout<<endl;
- }
- clrscr();
- //Rumus Perkalian
- for(b=0;b<3;b++)
- {
- for(k=0;k<3;k++)
- {
- C[b][k]=0;
- for(s=0;s<3;s++)
- {
- C[b][k]=A[b][s]*B[s][k]+ C[b][k];
- }
- }
- }
- //cetak Matiks A
- cout<<" Matriks A \n";
- for(b=0;b<3;b++)
- {
- for(k=0;k<3;k++)
- {
- cout<<A[b][k]; cout<<"\t";
- } cout<<endl;
- }
- //Cetak Matriks B
- cout<<" Matriks B \n";
- for(b=0;b<3;b++)
- {
- for(k=0;k<3;k++)
- {
- cout<<B[b][k]; cout<<"\t";
- } cout<<endl;
- }
- //Cetak Matriks C
- cout<<"===========================\n";
- cout<<" Matriks C \n";
- cout<<"===========================\n";
- for(b=0;b<3;b++)
- {
- for(k=0;k<3;k++)
- {
- cout<<C[b][k]; cout<<"\t";
- } cout<<endl;
- }
- getch();
- }
Add Comment
Please, Sign In to add comment