Write a program to multiply 3x3 matrics



Write a program to multiply 3x3 matrics..

Answer / sandip khairnar

#include<conio.h>
void main()
{
int i,j,k,sum,a[3][3],b[3][3],c[3][3];
clrscr();
cout<<"enter matrix1";
for(i=0;i<3;i++)
for(j=0;j<3;j++)
cin>>a[i][j];
cout<<"enter matrix2";
for(i=0;i<3;i++)
for(j=0;j<3;j++)
cin>>b[i][j];
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
{
sum=0;
for(k=0;k<3;k++)
sum=sum+(a[i][k]*b[k][j]);
c[i][j]=sum;
}
}
cout<<"output:"<<endl;
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
cout<<c[i][j]<<" ";
cout<<endl;
}
}

Is This Answer Correct ?    2 Yes 2 No

Post New Answer

More OOPS Interview Questions

what is the use of classes in c++;

2 Answers   HCL,


what is the difference b/w abstract and interface?

2 Answers   Merrill Lynch, Schneider, Scio Healthcare,


How can i write a code in c# to take a number from the user and then find all the prime numbers till the number entered by the user.

4 Answers   NIIT, TCS,


difine hierarchical inheritance.

9 Answers   ASD Lab, TCS,


why c++ is a highlevel language

3 Answers   Satyam, Tech Mahindra,






What is a unary operator?

5 Answers  


What is new keyword in oops?

0 Answers  


suppose A is a base class and B is the derved class. Both have a method foo which is defined as a virtual method in the base class. You have a pointer of classs B and you typecast it to A. Now when you call pointer->foo, which method gets called? The next part of the question is, how does the compiler know which method to call?

3 Answers   EA Electronic Arts,


how to tackle technical questions

1 Answers  


In OverLoading concept,Why they are not consider return value and why they are consider only parameters in method? For ex: public int Add(int a,int b){...} public String Add(int a,int b){...}

1 Answers  


What is ambiguity in inheritance?

0 Answers  


Why static Function is used in C++?

4 Answers   TCS,


Categories