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
Was 2000 a leap year?
What is default value of global variable in c?
pgm to find any error in linklist(in single linklist check whether any node points any of previous nodes instead of next node)
What are the types of i/o functions?
What is the purpose of & in scanf?
How do you use a 'Local Block'?
Explain how do you determine the length of a string value that was stored in a variable?
What are the uses of null pointers?
What’s the special use of UNIONS?
What is the correct code to have following output in c using nested for loop?
How can I copy just a portion of a string?
What is new line escape sequence?
Can main () be called recursively?
why arguments can generally be passed to functions a) sending the values of the arguments b) sending the addresses of the arguments c) a & b d) none of the above
What is a lvalue