Select Menu

Slider

Transportation

Civil Engineering

Cement Testing

Inventor

Manual Survey Practical

Quantity Surveying

Videos

» » Matrix Multiplication (C-Programming)
«
Next
Newer Post
»
Previous
Older Post


#include<stdio.h>
#include<conio.h>
void main()
{
int a[5][5],b[5][5],c[5][5];
int i,j,k;
clrscr();
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
scanf("%d",&a[i][j]);
}
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
scanf("%d",&b[i][j]);
}
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
{
c[i][j]=0;
for(k=0;k<3;k++)
c[i][j]+=a[i][k]*b[k][j];
}
}
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
printf("%d ",c[i][j]);
printf("\n");
}

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

getch();
}

«
Next
Newer Post
»
Previous
Older Post

No comments

Leave a Reply

Post Your Comments