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 |
what is the use of classes in c++;
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.
difine hierarchical inheritance.
why c++ is a highlevel language
3 Answers Satyam, Tech Mahindra,
What is a unary operator?
What is new keyword in oops?
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?
how to tackle technical questions
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){...}
What is ambiguity in inheritance?
Why static Function is used in C++?