answersLogoWhite

0

#include<stdio.h>

void main()

{

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

clrscr();

printf("Enter elements of A:");

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

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

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

printf("Enter elements of B:");

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

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

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

printf("A:");

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

{

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

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

printf("");

//To change line.

}

printf("B:");

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

{

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

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

printf("");

}

k=0;

while(k<=2)

{

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

{

int sum=0;

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

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

c[i][k]=sum;

}

k++;

}

printf("Result: ");

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

{

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

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

printf("");

}

getch();

}

User Avatar

Wiki User

12y ago

Still curious? Ask our experts.

Chat with our AI personalities

RossRoss
Every question is just a happy little opportunity.
Chat with Ross
MaxineMaxine
I respect you enough to keep it real.
Chat with Maxine
BeauBeau
You're doing better than you think!
Chat with Beau

Add your answer:

Earn +20 pts
Q: Program on matrix multiplication
Write your answer...
Submit
Still have questions?
magnify glass
imp