Skip to main content

#include <stdio.h>


int main() {

    int a[10][10], b[10][10], result[10][10];

    int r1, c1, r2, c2;

    int i, j, k;


    printf("Enter rows and columns of first matrix: ");

    scanf("%d %d", &r1, &c1);


    printf("Enter rows and columns of second matrix: ");

    scanf("%d %d", &r2, &c2);


    if (c1 != r2) {

        printf("Matrix multiplication not possible");

        return 0;

    }


    printf("Enter elements of first matrix:\n");

    for(i = 0; i < r1; i++) {

        for(j = 0; j < c1; j++) {

            scanf("%d", &a[i][j]);

        }

    }


    printf("Enter elements of second matrix:\n");

    for(i = 0; i < r2; i++) {

        for(j = 0; j < c2; j++) {

            scanf("%d", &b[i][j]);

        }

    }


    // Matrix Multiplication

    for(i = 0; i < r1; i++) {

        for(j = 0; j < c2; j++) {

            result[i][j] = 0;

            for(k = 0; k < c1; k++) {

                result[i][j] += a[i][k] * b[k][j];

            }

        }

    }


    printf("Resultant Matrix:\n");

    for(i = 0; i < r1; i++) {

        for(j = 0; j < c2; j++) {

            printf("%d ", result[i][j]);

        }

        printf("\n");

    }


    return 0;

}

Comments

Popular posts from this blog

baby ni guddalo na sulli

1. Palindrome Number A number is a palindrome if it reads the same backward as forward. #include <stdio.h> int main() { int n, reversed = 0, remainder, original; printf("Enter an integer: "); scanf("%d", &n); original = n; while (n != 0) { remainder = n % 10; reversed = reversed * 10 + remainder; n /= 10; } if (original == reversed) printf("%d is a palindrome.", original); else printf("%d is not a palindrome.", original); return 0; } output Enter an integer: 1 1 is a palindrome. === Code Execution Successful ===                  2a Pattern 1: The Vertical Bar (Pipe) Pattern This pattern uses the | character. Plaintext | | | | | | | | | | | | | | | C # include <stdio.h> int main () { int i, j; for (i = 1 ; i <= 5 ; i++) { for (j = 1 ; j <= i; j++) { printf ( "| " ); } printf ( "\n" ); } ...
Get free 100 bucks click me   Here is the link to get free 100$  Click me to get free 100$
  8(b) Classification of Magnetic Materials (5 Marks Answer) Magnetic materials are classified based on how they respond to a magnetic field. They are mainly divided into three types . 1. Diamagnetic Materials Diamagnetic materials are substances that are weakly repelled by a magnetic field . Properties: Magnetic susceptibility is negative . Magnetic permeability is less than 1 . They move from strong magnetic field to weak magnetic field . Examples: Bismuth, Copper, Silver, Gold. 2. Paramagnetic Materials Paramagnetic materials are substances that are weakly attracted by a magnetic field . Properties: Magnetic susceptibility is small and positive . Magnetic permeability is slightly greater than 1 . They move from weak magnetic field to strong magnetic field . Examples: Aluminium, Platinum, Chromium. 3. Ferromagnetic Materials Ferromagnetic materials are substances that are strongly attracted by a magnetic field . Properties: Magnetic susce...