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
how many types of operators are include in c language a) 4 b) 6 c) 8 d) 12
What is #line in c?
What does main () mean in c?
How can I find the modification date and time of a file?
What happens if a header file is included twice?
What are the types of unary operators?
Difference between malloc() and calloc() function?
What 'lex' does?
What is pointers in c?
Is there a built-in function in C that can be used for sorting data?
What is the maximum no. of arguments that can be given in a command line in C.?
What are valid operations on pointers?
What is the advantage of a random access file?
Is it valid to address one element beyond the end of an array?
Which one would you prefer - a macro or a function?