subject

Public static void arraymystery(int[] a) {
for (int i = 1; i < a. length - 1; i++) {
a[i] = a[i - 1] - a[i] + a[i + 1];
}
}
indicate in the right-hand column what values would be stored in the array after the method arraymysteryexecutes if each integer array below is passed as a parameter to it.

int[] a1 = {42, 42};
arraymystery(a1);

int[] a2 = {6, 2, 4};
arraymystery(a2);
int[] a3 = {7, 7, 3, 8, 2};
arraymystery(a3);

int[] a4 = {4, 2, 3, 1, 2, 5};
arraymystery(a4);

int[] a5 = {6, 0, -1, 3, 5, 0, -3};
arraymystery(a5);

i know the answers are:

{42, 42}

{6, 8, 4}

{7, 3, 8, 2, 2}

{4, 5, 3, 4, 7, 5}

{6, 5, 9, 11, 6, 3, -3}

ansver
Answers: 2

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 06:00, kiaunarayne808
The width of a piece of rectangular land is 5m shorter rhan 1/3 of its length .find the width of the land if the length is 60m,150m.
Answers: 1
image
Computers and Technology, 23.06.2019 07:00, Dvrsug8598
You need a quick answer from a coworker. the most effective way to reach your coworker is through a. cloud server b. instant message c. teleconference d. telepresence
Answers: 1
image
Computers and Technology, 24.06.2019 02:50, rurbanok12
Be sure to answer all parts. synthesize the following compound from benzene. a. b. c. d. e. f. reaction [1] conditions: a b c d e f reaction [1] product: draw structure reaction [2] conditions: a b c d e f reaction [2] product: draw structure reaction [3] conditions: a b c d e f reaction [3] product:
Answers: 3
image
Computers and Technology, 24.06.2019 11:00, airbenderjermai
Need fast im timed in a paragraph of 125 words, explain at least three ways that engineers explore possible solutions in their projects.
Answers: 2
You know the right answer?
Public static void arraymystery(int[] a) {
for (int i = 1; i < a. length - 1; i++) {

Questions in other subjects:

Konu
Computers and Technology, 02.03.2021 21:40
Konu
Mathematics, 02.03.2021 21:40