Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
ts4475 authored Oct 2, 2021
1 parent a9890fc commit 086775d
Showing 1 changed file with 53 additions and 0 deletions.
53 changes: 53 additions & 0 deletions Code/Matrix Multiplication.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
#include <iostream>
using namespace std;
int main()
{
int a[10][10],b[10][10],mul[10][10],r,c,i,j,k;
cout<<"Enter the number of rows\n";
cin>>r;
cout<<"Enter the number of columns\n";
cin>>c;
cout<<"Enter the first matrix element\n";

for(i=0;i<r;i++)
{
for(j=0;j<c;j++)
{
cin>>a[i][j];
}
}
cout<<"Enter the second matrix element\n";

for(i=0;i<r;i++)
{
for(j=0;j<c;j++)
{
cin>>b[i][j];
}
}

cout<<"Multiplication of the matrix :\n";

for(i=0;i<r;i++)
{
for(j=0;j<c;j++)
{
mul[i][j]=0;
for(k=0;k<c;k++)
{
mul[i][j]+=a[i][k]*b[k][j];
}
}
}


for(i=0;i<r;i++)
{
for(j=0;j<c;j++)
{
cout<<mul[i][j]<<" ";
}
cout<<"\n";
}
return 0;
}

0 comments on commit 086775d

Please sign in to comment.