1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Ratling [72]
2 years ago
6

Write a public static method diagSum, which takes a 2d array of int values as a parameter, and returns the sum of the elements i

n the lead diagonal as an int value. The lead diagonal is defined as the diagonal line of values starting in the top left corner and proceeding one step right and down for each value until either the bottom or right edge of the array is reached. For example, in the array represented below, the numbers in red make up the lead diagonal
Computers and Technology
1 answer:
saveliy_v [14]2 years ago
6 0

A 2d array (i.e. 2 dimensional array) represents its elements in rows and columns

<h3>The program in Java</h3>

The method in Java, where comments are used to explain each line is as follows

//This defines the method

public static int diagSum(int[][] myArray) {

    //This initializes sum to 0

    int sum = 0;

    //This iterates through each row of the array

               for (int i = 0; i < myArray.length; i++) {

                   //This calculates the sum of the diagonals

                       sum+=myArray[i][i];

               }

               //This returns the sum

               return sum;

       }

Read more about methods at:

brainly.com/question/15969952

You might be interested in
The analysts at Techno Info Systems are considering the four-model approach to system development for a new client. If they make
luda_lava [24]

Answer:

B

Explanation:

...if they make use of the four-model approach, the time taken to develop the model would increase.

Cheers

5 0
4 years ago
Lesson 12: while loops with the farmer. Number 9.
Vikki [24]

Answer:

just repeat the move forward as many times until you get to the hole and fill 1

Explanation:

i think this might work

if it does can i have brainliest

3 0
3 years ago
Read 2 more answers
What do you click on to minimize all open windows? the Show Desktop icon the Start menu the system tray the taskbar
SOVA2 [1]

Answer:

The answer to this question can be given as "The show desktop icon".

Explanation:

To minimize all open windows we use to click on the Show Desktop icon. When we click on this desktop icon it automatically minimize all the open windows that are open on the computer screen. And all the option are not correct that can be described as:

The Start menu is part of the Microsoft windows. Start menu offers a central launching point for system programs and executing other tasks.

The system tray is part of the Window. It is on the Taskbar. It contains miniature icons for easy access to system functions.

That's why the correct answer is "The show desktop icon".

7 0
4 years ago
Read 2 more answers
An employee sets up an automation that transfers files in a specific folder on their PC to a remote drive for archiving, provide
Yuri [45]

Answer:

Rule based automation

Explanation:

8 0
3 years ago
A terrestrial biome is named according to the _____ in which a group of plants and animals occur together.
ikadub [295]

Answer:

Predominate Vegetation

Explanation:

3 0
4 years ago
Other questions:
  • In the 2000s, Venezuelan President Hugo Chàvez instituted economic policies that caused smuggling and hoarding of food. What did
    15·1 answer
  • An administrator working on a Windows Server 2016 Server Core installation needs to disable DHCP on all interfaces on the server
    12·1 answer
  • A firewall is either software or dedicated hardware that exists between the __________ being protected.
    13·1 answer
  • Write the definition of the word "log" as it would be used in relation to digital literacy
    13·1 answer
  • Character positions in<br> arrays start counting with<br> the number 1.<br> True<br> False
    14·1 answer
  • Technology, by itself is neither good nor bad.<br> A) true<br> B) false
    11·2 answers
  • Can someone help me to write a python code to save list form python to CSV file please?​
    12·1 answer
  • What does it mean to influence the government? Use influence in a sentence.
    8·2 answers
  • PROGRAM LANGUAGE C
    5·1 answer
  • Which of the following should you press to insert a non-
    8·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!