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
Why can arithmetic operations not be performed on void pointers?
List some applications of c programming language?
why use "return" statement a) on executing the return statement it immediately transfers the control back to the calling program b) it returns the value present in the parentheses return, to the calling program c) a & b d) none of the above
What is Dynamic memory allocation in C? Name the dynamic allocation functions.
Why array is used in c?
Is c easier than java?
What is the difference between void main and main in c?
Explain how do you determine the length of a string value that was stored in a variable?
What is the value of uninitialized variable in c?
What do you understand by friend-functions? How are they used?
any "C" function by default returns an a) int value b) float value c) char value d) a & b
What is the use of bitwise operator?
Differentiate between functions getch() and getche().
differentiate built-in functions and user – defined functions.
What are pointers? Why are they used?