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:
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
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started