// *****MULTIPLICATION of Two Matrices*****//
#include<stdio.h>
#include<conio.h>
void main()
{
int i,j,sum,a[10][10],b[10][10],c[10][10],m,n,k=0;
clrscr();
printf(" *** MULTIPLICATION OF TWO MATRIXES ***");
printf("\nEnter the no. of rows & coloumns :\n");
scanf("%d%d",&m,&n);
if(m!=n)
printf("\nEnter The same no. of rows & coloumns !");
else
{
printf("Enter the elements of 1st matrix :\n");
for(i=0;i<m;i++)
{
for(j=0;j<n;j++)
scanf("%d",&a[i][j]);
}
printf("Enter the elements of 2nd matrix :\n");
for(i=0;i<m;i++)
{
for(j=0;j<n;j++)
scanf("%d",&b[i][j]);
}
{
while(k<n)
{
sum=0;
for(i=0;i<m;i++)
{
for (j=0;j<n;j++)
{
for(k=0;k<n;k++)
sum=sum+a[i][k]*b[k][j];
c[i][j]=sum;
sum=0;
}
}
}
printf("Result- Multipliccation of two Matrixes :\n");
for(i=0;i<m;i++)
{
for(j=0;j<n;j++)
printf("%d\t",c[i][j]);
{
printf("\n");
}
}
}
printf("\nThanks ! For using my Program.");
getch();
}
}
//Snap shot of output...
No comments:
Post a Comment