-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathNormalMltipli.cpp
More file actions
39 lines (34 loc) · 793 Bytes
/
NormalMltipli.cpp
File metadata and controls
39 lines (34 loc) · 793 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
#include<bits/stdc++.h>
using namespace std;
int main()
{
int m1[2][2],m2[2][2],m3[2][2];
for(int i=0;i<2;i++)
{
for(int j=0;j<2;j++)
{
cin>>m1[i][j];
cin>>m2[i][j];
}
}
int d1,d2,d3,d4,d5,d6,d7;
d1=(m1[0][0]+m1[1][1])*(m2[0][0]+m2[1][1]);
d2=(m1[1][1]+m1[1][0])*m2[0][0];
d3=m1[0][0]*(m2[0][1]+m2[1][1]);
d4= m1[1][1]*(m2[1][0]-m2[0][0]);
d5= (m1[0][0]+m1[0][1])*m2[1][1];
d6= (m1[1][0]-m1[0][0])*(m2[0][0]+m2[0][1]);
d7= (m1[0][1]-m1[1][1])*(m2[1][0]+m2[1][1]);
m3[0][0]=d1+d4-d5+d7;
m3[0][1]=d3+d5;
m3[1][0]=d2+d4;
m3[1][1]=d1-d2+d3+d6;
for(int i=0;i<2;i++)
{
for(int j=0;j<2;j++)
{
cout<<m3[i][j]<<" ";
}
cout<<" \n";
}
}