#include
int main(){
int r,c,sum,n;
int matrix1[3][3],matrix2[3][3],matrix3[3][3];
printf("Enter The Values for matrix1 : \n");
for(r=0;r<3;r++){
for(c=0;c<3;c++){
scanf("%d", &matrix1[r][c]);
}
}
printf("\n");
printf("Enter The Values for matrix2 : \n");
for(r=0;r<3;r++){
for(c=0;c<3;c++){
scanf("%d", &matrix2[r][c]);
}
}
printf("\n");
for(r=0;r<3;r++){
for(c=0;c<3;c++){
matrix3[r][c]=(matrix1[r][0]*matrix2[0][c])+
(matrix1[r][1]*matrix2[1][c])+
(matrix1[r][2]*matrix2[2][c]);
}
}
printf("The Product Matrix \n");
for(r=0;r<3;r++){
for(c=0;c<3;c++){
printf("%d" ,matrix3[r][c] );
printf(" ");
}
printf("\n");
}
return 0;
}
0 comments:
Post a Comment