//PROGRAM TO PERFORM SUBTRACTION OF TWO MATRICES
class SubMatrix
{
int a[ ][ ]={{1,2,3,4},{4,5,6,7}};
int b[ ][ ]={{0,4,7,2},{6,1,8,3}};
int c[ ][ ]={{0,0,0,0},{0,0,0,0}},i,j;
void subtract( )
{
for(i=0;i<2;i++)
{
for(j=0;j<4;j++)
{
c[i][j]=a[i][j]-b[i][j];
}
}
}
void output( )
{
System.out.println(“Subtraction of two matrices is: ” );
for(i=0;i<2;i++)
{
for(j=0;j<4;j++)
{
System.out.print(” “+c[i][j] );
}
System.out.println( );
}
}
}
class Testsub
{
public static void main(String args[ ])
{
SubMatrix s=new SubMatrix( );
s.subtract( );
s.output( );
}
}