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
What are the advantages of c language?
Write a C/C++ program to add a user to MySQL. The user should be permitted to only "INSERT" into the given database.
How do you define CONSTANT in C?
Explain the binary height balanced tree?
List some applications of c programming language?
Which is better oop or procedural?
Why double pointer is used in c?
Mention four important string handling functions in c languages .
What are types of structure?
Write a C/C++ program that connects to a MySQL server and checks if the InnoDB plug-in is installed on it. If so, your program should print the maximum number of concurrent threads that the InnoDB plug-in can create.
What is p in text message?
Is array a primitive data type in c?
Define C in your own Language.
Explain spaghetti programming?
What is #include cctype?