Question: How do I create an algorithm using a loop that will add all the values in all odd columns, and print their total aligned below

How do I create an algorithm using a loop that will add all the values in all odd columns, and print their total aligned below the column. Should look like this:

 How do I create an algorithm using a loop that will

What i have so far:

public class ArrayMath { public static void main(String[] args) { //Creating an two Dimensional Array int arr[][]=new int[10][10]; //calling the method by passing the array as argument arrays(arr); } private static void arrays(int[][] arr) { //Declaring variables int sumOfOddCols=0; int sumofAllElements=0; //Populating the elements into the 2-D array for(int i=0;i 0 0 0 0 0 0 8 8 10 12 14 16 18 9 12 15 18 21 24 27 8 12 16 20 24 28 32 36 5 10 15 20 25 30 35 40 45 6 12 18 24 30 36 42 48 54 7 14 21 2835 42 49 56 63 8 16 24 32 4 48 56 64 72 9 18 273645 54 63 7281 405 0 0 0 otal: 45 135 225 315

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!