Skip to content

Commit 3ae4be7

Browse files
authored
Add files via upload
1 parent 7c0ecee commit 3ae4be7

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed

matrix_multiplication.cpp

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
//write a programme to implement matrix multiplication
2+
#include<iostream>
3+
using namespace std;
4+
int a[50][50],b[50][50],c[100][100];
5+
int i,j,k,p,q,m,n,r,s;
6+
cout<<"enter size of matrix1"<<endl;
7+
cin>>m>>n;
8+
cout<<"enter size of matrix 2"<<endl;
9+
cin>>r>>s;
10+
for(i=0;i<n;i++)
11+
{
12+
for(j=0;j<m;j++)
13+
{
14+
cin>>a[i][j];
15+
}
16+
}
17+
cout<<"enter second matrix"<<endl;
18+
for(i=0;i<s;i++)
19+
{
20+
for(j=0;j<r;j++)
21+
{
22+
cin>>b[i][j];
23+
}
24+
}
25+
for(i=0;i<n;i++)
26+
{
27+
for(j=0;j<s;j++)
28+
{
29+
for(k=0;k<m;k++)
30+
{
31+
*(*(c+i)+j)+=*(*(a+i)+j)*(*(*b+k)+j);
32+
}
33+
}
34+
}
35+
for(i=0;i<n;i++)
36+
{
37+
for(j=0;j<s;j++)
38+
{
39+
cout<<c[i][j];
40+
}
41+
}

0 commit comments

Comments
 (0)