to find the program of matrix multiplication using arrays
Answer Posted / brajesh kumar dwivedi
#include<iostream.h>
#include<conio.h>
const size=10;
void main()
{
int a[size][size],b[size][size],c[size][size],n,m,i,j,k;
char v;
clrscr();
do
{
m=n=3;
cout<<"Enter a 3X3 matrix(1)\n";
for(i=0;i<m;i++)
{
for(j=0;j<n;j++)
{
cin>>a[i][j];
}
}
cout<<"Enter a 3X3 matrix(2)\n";
for(i=0;i<m;i++)
{
for(j=0;j<n;j++)
{
cin>>b[i][j];
}
}
for(i=0;i<m;i++)
{
for(j=0;j<n;j++)
{
c[i][j]=0 ;
for(k=0;k<n;k++)
{
c[i][j]=c[i][j]+(a[i][k]*b[k][j]);
}
}
}
cout<<"The product matrix is :"<<endl;
for(i=0;i<m;i++)
{
cout<<endl;
for(j=0;j<n;j++)
{
cout<<c[i][j]<<"\t";
}
}
cout<<"\nWanna do it again ? (y/n)";
cin>>v;
}
while(v=='y'||v=='Y');
getch();
}
| Is This Answer Correct ? | 39 Yes | 26 No |
Post New Answer View All Answers
What is your stream meaning?
What is wrong with this program statement? void = 10;
What is the use of typedef in c?
How do you write a program which produces its own source code as output?
Tell me what are bitwise shift operators?
Is printf a keyword?
What are the advantages of using linked list for tree construction?
Are pointers integers in c?
How do I send escape sequences to control a terminal or other device?
What are the advantages of using macro in c language?
5 Write an Algorithm to find the maximum and minimum items in a set of ānā element.
How do you determine the length of a string value that was stored in a variable?
What is a structure in c language. how to initialise a structure in c?
What is the use of getchar functions?
How do you convert strings to numbers in C?