to find the program of matrix multiplication using arrays
Answer Posted / nikhil verma
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int a[2][2],b[2][2],c[2][2],i,j;
cout<<"ENTER THE ELEMENT OF FIRST MATRIX"<<"\n";
for(i=1;i<=2;i++)
{
for(j=1;j<=2;j++)
{
cin>>a[i][j];
}
}
cout<<" THE FIRST MATRIX IS :"<<"\n";
for(i=1;i<=2;i++)
{
for(j=1;j<=2;j++)
{
cout<<a[i][j]<<"\t";
}
cout<<"\n";
}
cout<<"ENTER THE ELEMENT OF SECOND MATRIX IS "<<"\n";
for(i=1;i<=2;i++)
{
for(j=1;j<=2;j++)
{
cin>>b[i][j];
}
}
cout<<"THE SECOND MATRIX IS:"<<"\n";
for(i=1;i<=2;i++)
{
for(j=1;j<=2;j++)
{
cout<<b[i][j]<<"\t";
}
cout<<"\n";
}
cout<<"THE MATRIX IS:"<<"\n";
for(i=1;i<=2;i++)
{
for(j=1;j<=2;j++)
{
c[i][j]=0;
for(int k=1;k<=2;k++)
{
c[i][j]=c[i][j]+(a[i][k] * b[k][j]);
}
}
}
cout<<"THE MULTIPLICATION OF THE MATRIX IS:"<<"\n";
for(i=1;i<=2;i++)
{
cout<<"\n";
for(j=1;j<=2;j++)
{
cout<<c[i][j]<<"\t";
}
cout<<"\n";
}
getch();
Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
in linking some of os executables are linking name some of them
How can I display a percentage-done indication that updates itself in place, or show one of those twirling baton progress indicators?
what is associativity explain what is the precidence for * and & , * and ++ how the folloing declaration work 1) *&p; 2) *p++;
Explain the Difference between the New and Malloc keyword.
What is wrong with this initialization?
Is fortran still used in 2018?
What is null pointer constant?
What is pass by value in c?
Can we assign string to char pointer?
How is pointer initialized in c?
What is indirection? How many levels of pointers can you have?
Is c call by value?
what is associativity explain what is the precidence for * and & , * and ++ how the folloing declaration work 1) *&p; 2) *p++;
How do I convert a string to all upper or lower case?
Can one function call another?