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
Daniel [21]
3 years ago
11

Write a for loop that sets each array element in bonusScores to the sum of itself and the next element, except for the last elem

ent which stays the same. Be careful not to index beyond the last element. Ex: If bonusScores = [10, 20, 30, 40], then after the loop bonusScores = [30, 50, 70, 40] The first element is 30 or 10 + 20, the second element is 50 or 20 + 30, and the third element is 70 or 30 + 40. The last element remains the same. function bonusScores = CombineScores(numberScores, userScores) % numberScores: Number of scores in array bonusScores % bonusScores: User defined array of test scores % Write a for loop that sets each array element in bonusScores to % the sum of itself and the next element, except for the last element % which stays the same bonusScores = userScores; end Code to call your function when you click Run
Computers and Technology
1 answer:
Nat2105 [25]3 years ago
3 0

Answer:

The program to this question can be given as:

Program:

#include<stdio.h>  //header file.

int main()

 //main function

{

   int SCORES_SIZE = 4;  //define variables.

   int bonusScores[]={10,20,30,40};  //define array.

   int i;

   printf("Values:");

 //message

   for (i = 0; i < SCORES_SIZE; ++i)  //loop for print values.

   {

       printf("%d ", bonusScores[i]);

   }

void CombineScores(int numberScore, int userScore) //function

{

   for (i = 0; i < SCORES_SIZE; i++)

  //loop for convert values

   {

       if (( bonusScores[i] <= bonusScores[i +1] ) || (bonusScores[i] < bonusScores [i+1]))  //check array elements

       {

           bonusScores[i] = (bonusScores [i] + bonusScores[i+1]);

 //add values

       }

       else

       {

           bonusScores[i] = bonusScores[i];

       }

   }

   printf("\nReturn values:");  //message

 for (i = 0; i < SCORES_SIZE; i++)

{

printf("%d",bonusScores[i]);

}

}

CombineScores(0,0); //calling

return 0;

}  

Output:

Values:10 20 30 40  

Return values:30 50 70 40  

Explanation:

In the above c++ programming code firstly we define the header file. Then we define the main function in this function we define variable that name is given in the question that is SCORES_SIZE, i. Variable i is used in the loop for a print array. Then we define and initialize an array. The array name is and elements are define in the question that is bonusScores[]={10,20,30,40}. Then we use the loop for print array elements.Then we define function that is CombineScores() in this we pass two parameter. Then we use the second time in this loop we check array elements and add the elements that are given in the question. In this function we print values and at the end we call function.

You might be interested in
What number system do people in America use?
Sindrei [870]

Answer:

Base-10 (decimal)

Explanation:

8 0
3 years ago
Read 2 more answers
i have been looking for like 20 mins now and cant find the answers to test 3 on edhesive. does anybody have an clue to where i c
frez [133]

Answer:

Try looking it up. If not, go with your gut!

3 0
2 years ago
West Point Bridge Designer | Does anyone know a way to make this bridge cost less?
e-lub [12.9K]
Make the zig zag part more spaced out
4 0
2 years ago
What are the steps to add a bibliography to a document? 1. Create a using the proper steps. 2. Go to the tab on the ribbon. 3. I
olasank [31]

Answer:

The steps required to add a bibliography after adding the sources of the information contained in the document and marking the references made in the text, are;

1. Click to select insertion point of the bibliography

2. Select the Reference tab by clicking on the Reference tab in the ribbon

3. Within the Citations & Bibliography group, select Bibliography to open  a dropdown list of bibliography format

4. Select the applicable format

5. By selecting the desired bibliography format, the bibliography is inserted at the selected insertion point of the document

Explanation:

6 0
3 years ago
To store non-duplicated objects in the order in which they are inserted, use:______
Umnica [9.8K]

Answer:

b. LinkedHashSet

Explanation:

A LinkedHashSet is an ordered version of HashSet that maintains a doubly-linked List across all elements. When the iteration order is needed to be maintained this class is used. LinkedHashSet maintains a linked list of the entries in the set, in the order in which they were inserted.

4 0
3 years ago
Other questions:
  • Which sentences in the passage show the preventive measures to avoid data breach?
    9·1 answer
  • Professor Zak allows students to drop the four lowest scores on the ten 100 point quizzes she gives during the semester. Design
    13·1 answer
  • Write a method called swapPairs that switches the order of values in an ArrayList of strings in a pairwise fashion. Your method
    9·1 answer
  • What is one of the differences between Random Access Memory (RAM) and Read Only Memory (ROM)? RAM is where files are stored, and
    6·2 answers
  • . If you have written the following source code:
    9·1 answer
  • What process periodically validates a user’s account, access control, and membership role on inclusion in a specific group?a. Re
    12·1 answer
  • Has anyone on here heard from lilkoadkmillines?
    10·1 answer
  • An algorithm is:
    14·1 answer
  • 9. Which is an example of a function?<br>(1 Point)<br>=A1 +A2<br>=SUM(A1:A3)<br>=ADD(A1:A3)​
    14·2 answers
  • Ethics related to all <br> artificial intelligence?
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!