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


Please Help Members By Posting Answers For Below Questions

What is this pointer in c plus plus?

594


Where static variables are stored in c?

586


What is null pointer constant?

594


The postoder traversal is 7,14,3,55,22,5,17 Then ur Inorder traversal is??? please help me on this

2934


Difference between Function to pointer and pointer to function

630






What is typedf?

668


What is the difference between ā€˜gā€™ and ā€œgā€ in C?

2535


Why main is not a keyword in c?

650


What is the difference between c and python?

586


Explain 'far' and 'near' pointers in c.

706


What is far pointer in c?

811


in any language the sound structure of that language depends on its a) character set, input/output function, its control structures b) character set, library functions, input/output functions its control structures c) character set, library functions, control sturctures d) character set, operators, its control structures

677


Why is c still so popular?

618


Given a valid 24 hour format time find the combination of the value and write a program ,do not hard the value and if any other inputs provided should work with the logic implemented Input: 11:30 Output: 13:10 Input: 18:25 Output: 21:58

1117


write a program that reads lines(using getline), converts each line to an integer using atoi, and computes the average of all the numbers read. also compute the standard deviation.

1981