#include<stdio.h> #include<conio.h> void main() { int i,j,m1[3][3],m2[3][3],result[3][3]; clrscr(); printf("\nFirst Matrix : \n"); for(i=0;i<3;i++) { for(j=0;j<3;j++) { printf("Enter Elements "); scanf("%d",&m1[i][j]); } } printf("Second Matrix Elements: \n"); for(i=0;i<3;i++) { for(j=0;j<3;j++) { printf("Enter Elements "); scanf("%d",&m2[i][j]); } } printf("Result Matrix : \n"); for(i=0;i<3;i++) { for(j=0;j<3;j++) { result1[i][j] = 0; for(k=0;k<3;k++) { result1[i][j] = result1[i][j] + m1[i][j] *m2[i][j]; } } } for(i=0;i<3;i++) { for(j=0;j<3;j++) { printf("%d ",result1[i][j]); } printf("\n"); } getch(); }
INPUT Enter First Matrix : Enter Element : 4 Enter Element : 4 Enter Element : 4 Enter Element : 4 Enter Element : 4 Enter Element : 4 Enter Element : 4 Enter Element : 4 Enter Element : 4 Enter Second Matrix : Enter Element : 3 Enter Element : 3 Enter Element : 3 Enter Element : 3 Enter Element : 3 Enter Element : 3 Enter Element : 3 Enter Element : 3 Enter Element : 3 OUTPUT 36 36 36 36 36 36 36 36 36