Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 4

#include<stdio.

h>

int main()

int x,y,a,b,M1[2][2], M2[2][2],multiM[2][2];

printf("Enter all the element for 'A' matrix of order 2 X 2 \n");

for(x=0;x<2;x++)

for(y=0;y<2;y++)

printf("a%d%d = ",x,y);

scanf("%d/t",&M1[x][y]);

printf("\n");

printf("Enter all the element for 'B' matrix of order 2 X 2 \n");

for(x=0;x<2;x++)

for(y=0;y<2;y++)

printf("b%d%d = ",x,y);

scanf("%d/t",&M2[x][y]);

printf("\n");

printf("Product of the Matrix 'A' and Matrix 'B' (A*B or C)is:\n");

multiM[0][0]=(M1[0][0]*M2[0][0])+(M1[0][1]*M2[1][0]);
multiM[0][1]=(M1[0][0]*M2[0][1])+(M1[0][1]*M2[1][1]);

multiM[1][0]=(M1[1][0]*M2[0][0])+(M1[1][1]*M2[1][0]);

multiM[1][1]=(M1[1][0]*M2[0][1])+(M1[1][1]*M2[1][1]);

for(x=0;x<2;x++)

for(y=0;y<2;y++)

if(multiM[x][y]<0)

printf("%d ", multiM[x][y]);

else

printf(" %d ", multiM[x][y]);

printf("\n");

Enter all the element for 'A' matrix of order 2 X 2

a00 = 2

a01 = 0

a10 = 7

a11 = 2
Enter all the element for 'B' matrix of order 2 X 2

b00 = 2

b01 = 3

b10 = 6

b11 = 9

Product of the Matrix 'A' and Matrix 'B' (A*B or C)is:

4 6

26 39

--------------------------------

Process exited after 43.06 seconds with return value 0

Press any key to continue . . .

Enter all the element for 'A' matrix of order 2 X 2

a00 = 9

a01 = 8

a10 = 4

a11 = 5

Enter all the element for 'B' matrix of order 2 X 2

b00 = 7

b01 = 8

b10 = 3

b11 = 2
Product of the Matrix 'A' and Matrix 'B' (A*B or C)is:

87 88

43 42

--------------------------------

Process exited after 35.14 seconds with return value 0

Press any key to continue . . .

You might also like