0

Excuse me,could you tell me what is wrong this my program.It seems normal.Please help me,thank you!

public class cccc{ public static void array(int [][]q,int [][]w, int [][]e){ for(int i=0;i<q.length;i++){ for(int j=0;i<q[i].length;j++){ e[i][j]=q[i][j]+w[i][j];} } } public static void result(int [][]t){ for(int i=0;i<t.length;i++){ for(int j=0;i<t[i].length;j++){ System.out.print(t[i][j] + " ");} System.out.println(); } } public static void main(String[]args){ int [][]a ={ {1,2,3},{4,5,6} }; int [][]b ={ {6,3,4},{5,1,2} }; int [][]c =new int[2][3]; array(a , b , c); System.out.println("array a"); result(a); System.out.println("array b"); result(b); System.out.println("array c"); result(c); } }

3rd Jul 2018, 2:31 PM
Hunt
Hunt - avatar
2 Answers
+ 1
My goodness😂😂😂,thank you very much!
3rd Jul 2018, 3:32 PM
Hunt
Hunt - avatar
0
Hunt for(int j=0;i<q[i].length;j++){ should be for(int j=0;j<q[i].length;j++){ and for(int j=0;i<t[i].length;j++){ should be for(int j=0;j<t[i].length;j++){
3rd Jul 2018, 2:44 PM
Andre Daniel
Andre Daniel - avatar