answersLogoWhite

0

/* multiplication of a 3*3 matrix*/

#include<stdio.h>

main()

{

int a[3][3],b[3][3],c[3][3];

int i,j,k;

printf("enter the elements in A matrix:\n");

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

{

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

{

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

}

}

printf("enter b matrix:\n");

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

{

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

{

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

}

}

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

{

printf("\n");

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("multiplication matrix is:\n");

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

{

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

{

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

}

printf("\n");

}

}

User Avatar

Wiki User

13y ago

Still curious? Ask our experts.

Chat with our AI personalities

LaoLao
The path is yours to walk; I am only here to hold up a mirror.
Chat with Lao
TaigaTaiga
Every great hero faces trials, and you—yes, YOU—are no exception!
Chat with Taiga
FranFran
I've made my fair share of mistakes, and if I can help you avoid a few, I'd sure like to try.
Chat with Fran

Add your answer:

Earn +20 pts
Q: How do you Write a C program for matrix?
Write your answer...
Submit
Still have questions?
magnify glass
imp