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
What is the difference between %d and %i?
write a c program in such a way that if we enter the today date the output should be next day's date.
Do pointers need to be initialized?
How can I copy just a portion of a string?
How are strings stored in c?
How can you check to see whether a symbol is defined?
What is pragma c?
Explain how do you print only part of a string?
What is the description for syntax errors?
Where are the auto variables stored?
What are valid signatures for the Main function?
Should I learn data structures in c or python?
To print the pattern 1 2 3 4 5 10 17 18 19 6 15 24 25 20 7 14 23 22 21 8 13 12 11 10 9
What are header files and explain what are its uses in c programming?
write a program to print the consecutive repeated character from the given string... input string is : hhhhjkutskkkkkggggj output should be like this: hhhhkkkkkgggg anyone help me...