class orn { 
		  public static double[][] multiply(double[][] left,double[][] right)
{
//multiplication of two matrices
int ii,jj,i,j,k;
int m1=left[0].length;
int n1=left.length;
int m2=right[0].length;
int n2=right.length;
double[][] b;
b=new double[m1][n2];
 if(n1 != m2)
 {
 System.out.println("inner matrix dimensions must agree");
 for(ii=0;ii<n1;ii++)
   {
   for(jj=0;jj<m2;jj++)
     b[ii][jj]=0;
   }
   return b;
 }
 for(i=0;i<m1;i++)
   {
   for(j=0;j<n2;j++)
     {
     for(k=0;k<n1;k++)
                b[i][j]+=left[i][k]*right[k][j];
     }
   }
return b;
//end of multiply of two matrices
}

				public static void main(String[] args)
				
				{
				
				double[][] ab={{1.0,2.0},{3.0,4.0},{4.0,5.0}};
				   double[][] ac={{3.0,4.0,5.0},{5.0,6.0,7.0}};
				   double az[][]=multiply(ab,ac);
				   for(int i=0;i<az.length;i++)
				  {for(int j=0;j<az[0].length;j++)
				  {System.out.print(az[i][j]+" ");
			  }
			  System.out.println();}
					  
} }
