Search & Find out

Sunday, December 6, 2009

multiplation of two matrix

#include "stdio.h"
#include "conio.h"

void main()
{
  int a[3][3], b[3][3], c[3][3],i,j,k;
  clrscr();
  printf("Welcome to Mulpilation of two matrix\n\n");
  for(i=1; i<=3; i++)
  {
   for(j=1; j<=3; j++)
   {
     printf("Enter the valuf of A[%d][%d]:  ",i,j);
     scanf("%d",&a[i][j]);
   }
  }

  printf("\n\n");

  for(i=1; i<=3; i++)
  {
   for(j=1; j<=3; j++)
   {
     printf("Enter the valuf of B[%d][%d]:  ",i,j);
     scanf("%d",&b[i][j]);
   }
  }

  for(i=1; i<=3; i++)
  {
    for(j=1; j<=3; j++)
    {
      for(k=1,c[i][j]=0; k<=3; k++)
      {
    c[i][j]=c[i][j] + ( a[i][k] * b[k][j] );
      }
    }
  }

  printf("\n\n");

  for(i=1; i<=3; i++)
  {
    for(j=1; j<=3; j++)
    {
      printf("%d\t",c[i][j]);
    }
    printf("\n");
  }

  getch();
}



Get the executable ( .exe ) file for this program..
Download

0 comments:

Post a Comment

 

My Blog List

Term of Use