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
How many bytes are occupied by near, far and huge pointers (dos)?
Describe the steps to insert data into a singly linked list.
Give differences between - new and malloc() , delete and free() ?
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.
Difference between MAC vs. IP Addressing
What is the use of sizeof?
What does int main () mean?
What is 'bus error'?
Are the expressions * ptr ++ and ++ * ptr same?
How can you allocate arrays or structures bigger than 64K?
What does s c mean on snapchat?
Which node is more powerful and can handle local information processing or graphics processing?
Describe newline escape sequence with a sample program?
How do we declare variables in c?
Is c still relevant?