to find the program of matrix multiplication using arrays
Answer Posted / rohit v.kamlakar
/* Program for matrix multiplication using 2D array
9/20/08
By:-
rohit.born2code@gamil.com or
rohit_kamlakar@rediff.com
*/
#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 ? | 62 Yes | 33 No |
Post New Answer View All Answers
Is malloc memset faster than calloc?
What is the difference between near, far and huge pointers?
What is %lu in c?
Explain argument and its types.
Function which gives a pointer to a binary trees const an integer value at each code, return function of all the nodes in binary tree.?
What is #include stdio h?
int main() { Int n=20,i; For(i=0;i<=n;i--) { Printf(“-“); Return 0;
What is call by value in c?
List out few of the applications that make use of Multilinked Structures?
What is the advantage of using #define to declare a constant?
What is the purpose of sprintf() function?
What are comments and how do you insert it in a C program?
What are external variables in c?
What are pointers? Why are they used?
What are the salient features of c languages?