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
What is d'n in c?
How can I generate floating-point random numbers?
What is the difference between constant pointer and constant variable?
Is null always equal to 0(zero)?
What are the uses of a pointer?
What is the difference between a string copy (strcpy) and a memory copy (memcpy)? When should each be used?
What is pivot in c?
What would be an example of a structure analogous to structure c?
What is array within structure?
write a program to copy the string using switch case?
What does the error 'Null Pointer Assignment' mean and what causes this error?
Explain union. What are its advantages?
How can a program be made to print the line number where an error occurs?
Why clrscr is used in c?
1234554321 1234 4321 123 321 12 21 1 1 12 21 123 321 1234 4321 1234554321