Question

Write a program in `C’ language that accepts two matrices as input and prints their product. Input: Two matrices A and B in two-dimensional arrays Output: Matrix `C’ which is result of A X B in the form of two dimensional array  

27 Apr 2023
Answer :
Word Count : 493

Here's an example program in C that accepts two matrices as input and prints their product:

 #include <stdio.h> #define MAX_ROWS 10 #define MAX_COLS 10 void matrixProduct(int A[][MAX_COLS], int B[][MAX_COLS], int C[][MAX_COLS], int rowsA, int colsA, int colsB) {     int i, j, k;     for (i = 0; i < rowsA; i++) {         for (j = 0; j < colsB; j++) {             C[i][j] = 0;             for (k = 0; k < colsA; k++) {                 C[i][j] += A[i][k] * B[k][j];             }         }     } } void printMatrix(int matrix[][MAX_COLS], int rows, int cols) {     int i, j;     for (i = 0; i < rows; i++) {         for (j = 0; j < cols; j++) {             printf("%d\t", matrix[i][j]);         }         printf("\n");     } } int main() {     int A[MAX_ROWS][MAX_COLS], B[MAX_ROWS][MAX_COLS], C[MAX_ROWS][MAX_COLS];     int rowsA, colsA, rowsB, colsB; 
____ ________ ________ __________ ________.
____ ______ ____ ______ ___ _____ _____ __________ ___.
______ ______ _______ _____ ________ ___ _________ ___ ________.
__________ _________ ____ __________ ______ __________ ______ ___ _______ ________.
___ ________ _____ ___ __________ ____ _________ ______ ___ ___ _______.
__________ _____ ___ ___ ___ _______.
_______ ___ ________ ________ ______ ___.
__________ _____ ______ ____ _________ _____ ________ ________ _____ _________.
_______ ______ __________ _______ _______ _________ _______ _____ _______ _____.
_______ ___ __________ __________ __________ __________ __________ _________.
________ _____ _____ _____ ____ ______ _______.
_____ _______ ____ ___ _____ ____ ________ ____.
_________ _____ _____ _______ ________ __________ _________ ____.
______ ________ _______ ________ ___ ________ __________.
_________ _____ ______ ________ ___ _________.
______ ________ ________ ____ ____ _______ _______ ______.
____ _______ ___ ___ _______ ___ _________ ____ ______ _______.
_____ _______ _______ _____ _____ _______ _______ _________ _________ ___ __________ ____.
_____ ________ _________ ________ __________.
_______ ________ __________ _____ __________ ______ ________ ____ ________ ________ _____.
________ ___ __________ _________ ___ _______ ____ ________ _______.
_____ _______ __________ _____ __________ ______ ________ ______ __________ ____.
______ _________ _______ ____ __________ __________ ___ _______ ____.
_________ ___ _______ ___ _______ _____.
______ ____ ______ ______ ________ ___ _________ _____ ___ _____.
______ _______ ________ __________ _________ _______ ___.
____ ________ _____ _____ _________ ________ _______ _________ __________ _________ _____.
_______ __________ ____ _______ _____ __________ _____ ___ ____.
_______ ___ ____ ____ ______ _________.
______ _____ _______ _________ ___ ________ ___.
______ _________ _______ __________ _____ ______ _______.
_________ ________ ___ __________ _______ ____.
____ __________ ______ ________ _____ __________ _____ ________ ________.
_________ _______ _________ _________ ______ ___ __________ ______.
_______ _____ ______ ___ ________.
___ ________ _____ ______ _____ _____ _____ ___ ____ __________.
__________.
IGNOU ACADEMY
Your IGNOU journey, made easier.
  • Solved Assignments
  • Study Notes
  • Guess Papers
  • Question Papers
Skip in 10
Top
📞
Call Support Instant phone assistance IGNOU MCSL 209 2022 2023 - Write a program in `C’ language that accepts two matrices as inp | IGNOU Academy
→
🟢
WhatsApp Chat Fast live messaging
→
Email Us Business enquiries & support
→