-
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathMATRIX MULTIPLICATION.cpp
More file actions
41 lines (37 loc) · 794 Bytes
/
MATRIX MULTIPLICATION.cpp
File metadata and controls
41 lines (37 loc) · 794 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
//PROGRAM THE GIVEN MATRIX MULTIPLICATION:
//SUMIT KUMAR
#include<iostream>
using namespace std;
int main()
{
int A[3][3] , B[3][3] , C[3][3] , i , j ,k ;
cout<<"Enter 9 numbers for A matrix:-"<<endl;
for(i=0;i<=2;i++)
{
for(j=0;j<=2;j++)
cin>>A[i][j];
}
cout<<"Enter 9 numbers for B matrix:-"<<endl;
for(i=0;i<=2;i++)
{
for(j=0;j<=2;j++)
cin>>B[i][j];
}
for(i=0;i<=2;i++)
{
for(j=0;j<=2;j++)
{
int sum=0;
for(k=0;k<=2;k++)
sum=sum+A[i][k]*B[k][j];
C[i][j]=sum;
}
}
for(i=0;i<=2;i++)
{
for(j=0;j<=2;j++)
cout<<C[i][j]<<" ";
cout<<endl;
}
return 0;
}