Write a program to Multiply Two matrices using Matrix Multiply Algorithm.

#include<iostream>
#include<stdlib.h>
using namespace std;
int main()
{
int i , j , k, rowA , colA , rowB , colB ;
// 1st matrix order input
cout<<“Enter 1st matrix order: “<<endl;
cout<<“Enter row size: “;
cin>>rowA;
cout<<“Enter col size: “;
cin>>colA;
//2nd matrix order input
cout<<“Enter 2nd matrix order: “<<endl;
cout<<“Enter row size: “;
cin>>rowB;
cout<<“Enter col size: “;
cin>>colB;
//declaring matices
int matrixA[rowA][colA];
int matrixmult[rowA][colB];
int matrixB[rowB][colB];
//checking the matrix is compatible or not
if( colA!=rowB )
{
cout<<“Incompatible Dimensions: “;
}
else
{
//input first matrix elements
cout<<“Enter 1st Matrix:\n”;
for( i=1 ; i<=rowA ; i++ )
{
for( j=1;j<=colA;j++)
{
cout<<“Enter the element at location [“<<i<<“][“<<j<<“] ::”;
cin>>matrixA[i][j];
}
}
//input 2nd matix elements

cout<<“Enter 2nd Martrix:\n”;
for( i=1 ; i<=rowB ; i++ )
{
for( j=1 ; j<=colB ; j++ )
{
cout<<“Enter the element at location [“<<i<<“][“<<j<<“] ::”;
cin>>matrixB[i][j];
}
}
//Multiplying two matrices using Matrix Multiply algorithm

for( i=1 ; i<=rowA ; i++ )
{
for( j=1 ; j<=colB ; j++ )
{
matrixmult[i][j]=0;
for( k=1 ; k<=colA ; k++)
{
matrixmult[i][j]=matrixmult[i][j]+matrixA[i][k]*matrixB[k][j];
}
}
}
//printing the matrix
cout<<“The matrix After Multiplication is : “<<endl;
for( i=1 ; i<=rowA ; i++ )
{
for( j=1;j<=colB;j++)
{
cout<<matrixmult[i][j]<<“\t”;
}
cout<<endl;
}

}
system(“pause”);

}