i copied the code as is discussed by my professor and written in my course book but i am not getting the correct output. my logic is very clear but not getting the right output, its a bunch of positive n negative values. pls check . the code is compiling well .
#include<iostream.h>
#include<conio.h>
int main()
{ int m,n,r;
cout<<"enter the order ";
cin>>m>>n>>r;
int mat1[10][10] ,mat2[10][10],mat3[20][20];
cout<<"enter the elements of first array " <<endl;
for(int i=0;i<m;i++)
{
for(int j=0;j<n;j++)
{
cin>>mat1[i][j];
}
}
cout<<"enter the elements of the sec matrix ";
for(int i=0;i<n;i++)
{
for(int j=0;j<r;j++)
{
cin>>mat2[i][j];
}
}
cout<<"\n the resultant matrix is "<<endl;
for( int i=0;i<m;i++)
{
for( int j=0;j<n;j++)
{
mat3[i][j]=0;
for( int k=0;k<r;k++)
{
mat3[i][j]=mat3[i][j]+(mat1[i][k]*mat2[k][j]);
cout<<mat3[i][j]<<" ";
}
cout<<mat3[i][j]<<" ";
}
cout<<endl;
}
getch();
return 0;
}