Posts

Showing posts with the label multipy two matrices

Matrix Program #1

Image
8. Read two n x n matrices and perform addition of matrices into third matrix and print it. #include<stdio.h> void main() {    int i, j, mat1[10][10], mat2[10][10], mat3[10][10];    int row1, col1, row2, col2;    printf("Enter the number of Rows of Mat1 : ");    scanf("%d", &row1);    printf("Enter the number of Columns of Mat1 : ");    scanf("%d", &col1);    printf("Enter the number of Rows of Mat2 : ");    scanf("%d", &row2);    printf("Enter the number of Columns of Mat2 : ");    scanf("%d", &col2);    /* Before accepting the Elements Check if no of     rows and columns of both matrices is equal */    if (row1 != row2 || col1 != col2)    {       printf("\nOrder of two matrices is not same\n");       return ;    }   printf("\n"); ...