Program of multiplication of two matrix in c language.

■》program of multiplication of two matrix          in c language. 

#include<stdio.h>

#include<conio.h>

void main()

{

  int a[2][2],b[2][2],c[2][2],i,j,k;

  clrscr();

  printf("enter the 4 numbers for first matrix=");

  for(i=0; i<2; i++)

  {

     for(j=0; j<2; j++)

     {

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

     }

  }

  printf("enter the 4 numbers for second.                matrix=");

  for(i=0; i<2; i++)

  {

   for(j=0; j<2; j++)

    {

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

    }

  }

  for(i=0; i<2; i++)

  {

   for(j=0; j<2; j++)

   {  

   c[i][j]=0;

    for(k=0; k<2; k++)

    {

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

    }

   }

  }

   printf("the multiplication of matrix is=\n");

   for(i=0; i<2; i++)

  {

   for(j=0; j<2; j++)

   { 

   printf("%d\t",c[i][j]);

   }

   printf("\n");

  }

  getch();

  }

■》Output->



Comments

Popular posts from this blog

Introduction of java Programming language.

Stack data structure.