write two program in c matrix multiplication

 

 

         ///program----///


// write two program in c matrix multiplication [2*2]//

#include<stdio.h>
#include<conio.h>
int main()
{
    int A[2][2],B[2][2],C[2][2],i,j,k;
    for(i=0; i<2; i=i+1)
    {
        for(j=0; j<2; j=j+1)
        {
            scanf("%d",&A[i][j]);

        }

    }
    for(i=0; i<2; i=i+1)
    {
        for(j=0; j<2; j=j+1)
        {
            scanf("%d",&B[i][j]);

        }

    }
    for(i=0; i<2; i=i+1)
    {
        for(j=0; j<2; j=j+1)
        {
            C[i][j]=0;
            for(k=0; k<2; k=k+1)
            {
                C[i][j]=C[i][j]+A[i][k]*B[k][j];
            }
            printf("%d\t",C[i][j]);
        }
        printf("\n");
    }
    getch();
    return 0;
}


Output

2  3

4  4

5  6

23      26

23      26

Comments

Popular posts from this blog

AKTU : 9 Computer System Security Quiz answer

AKTU : 8 Computer System Security Quiz answer

T20 squad team