Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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:

image text in transcribed

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Climate And Environmental Database Systems

Authors: Michael Lautenschlager ,Manfred Reinke

1st Edition

1461368332, 978-1461368335

More Books

Students also viewed these Databases questions

Question

1. Give an example of hierarchical planning in an organization.

Answered: 1 week ago

Question

What are the features of Management?

Answered: 1 week ago

Question

Briefly explain the advantages of 'Management by Objectives'

Answered: 1 week ago

Question

Explain the various methods of job evaluation

Answered: 1 week ago