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
Write a program to show the change in position of a cursor using c
What is bin sh c?
Explain how are portions of a program disabled in demo versions?
What is the use of #include in c?
What are two dimensional arrays alternatively called as?
What does char * * argv mean in c?
What is the use of function overloading in C?
provide an example of the Group by clause, when would you use this clause
Can you pass an entire structure to functions?
What is the difference between scanf and fscanf?
What is "Hungarian Notation"?
What is the purpose of void pointer?
What are the 32 keywords in c?
When can a far pointer be used?
1234554321 1234 4321 123 321 12 21 1 1 12 21 123 321 1234 4321 1234554321