1. Given two matrices of order M1*N1 and M2*N2. Write function to perform matrix multiplication and display the resultant matrix if matrix multiplication is possible otherwise display the message "Invalid Matrices". Sol: #include int main() { i nt m, n, p, q, c, d, k, sum = 0; int first[10][10], second[10][10], z[10][10]; printf("\nEnter the number of rows and columns of first matrix:\n"); scanf("%d%d", &m, &n); printf("\nEnter the number of rows and columns of second matrix:\n"); scanf("%d%d", &p, &q); if ( n != p ) { printf("\nMatrices with entered orders can't be multiplied with each other.\n"); printf("\nThe column of first matrix should be equal to row of second.\n"); } else { printf("\nEnter the elements of first matrix:\n"); for ( c = 0 ; c < m ; c++ ) for ( d = 0 ; d < n ; d++ ) scanf...
Comments
Post a Comment