#include<stdio.h> void main() { int a[2][2],b[2][2],c[2][2],i,j; clrscr(); printf("Enter the value of First 2 x 2 Matrix : "); for(i=0;i<2;i++) { for(j=0;j<2;j++) { scanf("%d",&a[i][j]); } } printf("Enter the value of Second 2 x 2 Matrix : "); for(i=0;i<2;i++) { for(j=0;j<2;j++) { scanf("%d",&b[i][j]); } } for(i=0;i<2;i++) { for(j=0;j<2;j++) { c[i][j]=a[i][j]*b[i][j]; printf("Sum of Two Matrix : %d\n",c[i][j]); } } getch(); }
Enter the value of First 2 x 2 Matrix : 1 2 3 4 Enter the value of Second 2 x 2 Matrix : 4 3 2 1 Sum of Two Matrix : 4 Sum of Two Matrix : 6 Sum of Two Matrix : 6 Sum of Two Matrix : 4