Matrix Multiplication Program of C++ using for loop Unknown 03:39 loop Edit Multiplication of Two Matrix #include<iostream.h> #include<conio.h> int main() { cout<<" Program OF MAtrix Multiplication"<<endl<<endl; int i,b,m,n,c,d,e,f,z,k; int a[60][60],g[60][60]; cout<<" Enter the Rows of First Matrix ===="; cin>>c; cout<<" Enter the column of First Matrix ===="; cin>>d; cout<<" Enter the Rows of seond Matrix ===="; cin>>e; cout<<" Enter the column of second Matrix ===="; cin>>f; for(i=0;i<c;i++) { for(b=0;b<d;b++) { cout<<"enter location at"<<i<<b<<endl; cin>>a[i][b]; } } for(i=0;i<c;i++) { for(b=0;b<d;b++) { cout<<a[i][b]<<"\t"; } cout<<endl; } for(i=0;i<e;i++) { for(b=0;b<f;b++) { cout<<"enter location at"<<i<<b<<endl; cin>>g[i][b]; } } for(i=0;i<e;i++) { for(b=0;b<f;b++) { cout<<g[i][b]<<"\t"; } cout<<endl; } cout<<endl; for(i=0;i<c;i++) { for(b=0;b<f;b++) { z=0; for(k=0;k<e;k++) z=z+(a[i][k]*g[k][b]); cout<<z<<"\t"; } cout<<endl; } } Share on Facebook Share on Twitter Share on Google Plus About Unknown This is a short description in the author block about the author. You edit it by entering text in the "Biographical Info" field in the user admin panel. RELATED POSTS
0 comments:
Post a Comment