0

create a program: array 5 containers and input numbers, get the numbers then add all and display the answers

:'(

17th Sep 2016, 12:44 AM
Julius P. Orinion
Julius P. Orinion - avatar
4 Antworten
0
// i dunno if u want a single or a double dimensional array so am giving u a double dimensional array of 3 rows and 3 columns class matrix { void matrixSum( int Y [][]) { int sum = 0; // the following statements prints the above input array Y[][] in matrix form System.out.println("Output matrix"); for (int j = 0; j<3; j++) // this loop manages row indexes { for (int k = 0; k<3; k++)// this loop manages column indexes { System.out.print(Y[j][k]+"\t"); // matrix print statement. DO NOT USE println() HERE sum = sum + Y[j][k]; // adding all elements } // for 'k' loop ends here System.out.println(); // must be used to print array in matrix form. It changes line }// for 'j' loop ends here System.out.println(" Sum of odd numbers = "+sum); } }
18th Sep 2016, 7:09 AM
Andy
Andy - avatar
+ 1
please explain more
17th Sep 2016, 10:02 AM
bayram akdemir
bayram akdemir - avatar
0
Hope this helps 😊😆
18th Sep 2016, 7:10 AM
Andy
Andy - avatar
0
thanks
10th Sep 2017, 4:34 AM
Julius P. Orinion
Julius P. Orinion - avatar