0

# Mattrix addition and subtraction

Program

2 Answers

+ 1

//for this it must be a square matrix
and for subtraction use only minus sign in operation thats it...
private static int[][] add(int a[][],int b[][])
{
int size=a.length;
int c[][]=new int[size][size];
for(int i=0;i<size;i++)
{
for(int j=0;j<size;j++)
{
c[i][j]=a[i][j]+b[i][j];
}
}
return c;
}

0

how can I solve this problem