to find the program of matrix multiplication using arrays

Answer Posted / suman kumar das.

//matrix multiplication program
#include<stdio.h>
#include<conio.h>

void main()
{
clrscr();
int i,j,k,a[3][3],b[3][3],c[3][3],sum,m=3,l=3;

printf("\n enter value of first matrix:\n");
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
scanf("%d",&a[i][j]);
}
printf("\n enter value of second matrix:\n");
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
scanf("%d",&b[i][j]);
}
for(i=0;i<m;i++)
{
for(j=0;j<l;j++)
{
c[i][j]=0;
for(k=0;k<l;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]);
}
getch();

}

Is This Answer Correct ?    24 Yes 14 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How many bytes are occupied by near, far and huge pointers (dos)?

678


Describe the steps to insert data into a singly linked list.

624


Give differences between - new and malloc() , delete and free() ?

614


Write a program to replace n bits from the position p of the bit representation of an inputted character x with the one's complement. Method invertBit takes 3 parameters x as input character, p as position and n as the number of positions from p. Replace n bits from pth position in 8 bit character x. Then return the characters by inverting the bits.

3694


Difference between MAC vs. IP Addressing

644






What is the use of sizeof?

559


What does int main () mean?

554


What is 'bus error'?

651


Are the expressions * ptr ++ and ++ * ptr same?

671


How can you allocate arrays or structures bigger than 64K?

687


What does s c mean on snapchat?

590


Which node is more powerful and can handle local information processing or graphics processing?

831


Describe newline escape sequence with a sample program?

660


How do we declare variables in c?

575


Is c still relevant?

646