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]
3 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]3 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
Mia uses the formula pi times r to the power of 2 to find the area of a circle. What is pi times r to the power of 2 an example
erik [133]
A telescope , I think
5 0
3 years ago
Read 2 more answers
D. The 7-bit ASCII code for the character '&amp;' is:
insens350 [35]

Answer:

00100110

a and d are invalid sequences because they contain an even number of 1's.

Explanation:

Odd parity means that you want an odd number of 1's in the resulting set of bits. Since there are 3 (=odd) bits in the set, a zero must be added to keep the total odd.

6 0
4 years ago
What is a WYSIWIG program
jeyben [28]

Answer:

WYSIWYG means "what you see is what you get ".

Explanation:

It is type of editor or program that helps while creating a document. This program allows us to see the end result while creating a document i terms of who document will look like after completion.

4 0
3 years ago
HELLO. A computer can only understand the numbers 1 and 2.<br><br> TRUE OR FALSE
dimulka [17.4K]

FALSE

I know they can understand 0's

3 0
3 years ago
What is the name of the port that you plug an ethernet network cable into?
IrinaVladis [17]

the answer is RJ-45

3 0
4 years ago
Other questions:
  • A document repository is down when you attempt to access it. which isa principle is being violated?
    13·1 answer
  • Riley is using access to collect data for a science project. he is creating a report and wants to apply predefined color and fon
    6·1 answer
  • Most editing commands in Word, such as cut, copy, and paste, can be found on which tab?
    9·2 answers
  • What is the point of completing a value assessment while searching for a career
    11·1 answer
  • How can volunteering to help plan a fundraiser for your team or club be a way
    7·1 answer
  • Assume that a single page of printed text requires 52 lines of text, and that each line of text averaged 80 characters. If each
    9·1 answer
  • State whether the following statement are true or false​
    6·1 answer
  • Mohammed’s parents learn that his classmates have begun sending him text messages making fun of his heritage. Mohammed says he’s
    5·2 answers
  • The cpu stores the results of computations in ________.
    8·2 answers
  • Identify the places in the code where there are object-oriented concept violations, content coupling, common coupling, control c
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!