Mattrix addition and subtraction | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Mattrix addition and subtraction

Program

2nd Jan 2017, 2:58 AM
Pooja Jain
Pooja Jain - avatar
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; }
2nd Jan 2017, 3:26 AM
Ashwaghosh Sadanshiv
Ashwaghosh Sadanshiv - avatar
0
how can I solve this problem
2nd Jan 2017, 3:14 AM
sai