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 is the importance of test documentation?
drek231 [11]

Answer:

Why Is Test Documentation Important? Testing without documentation makes it difficult to see the complete picture of the project. Unless you have clear objectives, a step-by-step plan to achieve them, and all the important conditions specified in a document, an outcome remains blurry.

6 0
2 years ago
Read 2 more answers
Please help me with this
olasank [31]

Answer:

restart the computer! if that doesnt work, try going to audio settings and looking around for anything out of place.

Explanation:

8 0
3 years ago
What is the line tool used for in photoshop
ale4655 [162]
Creates line<span> shapes and paths.</span>
5 0
3 years ago
Factoring is the revers of​
aivan3 [116]

Answer:

Reverse factoring, also called supply chain finance, works in the opposite direction of invoice factoring. Instead of a company factoring customer invoices, it factors supplier invoices. In doing so, the company is factoring part of the supply chain. Reverse factoring is an accounts payable solution.Aug 28, 2019

Explanation:

6 0
3 years ago
A mysql prompt has been opened for you. Using the college database, complete the following tasks (use either a single-line or a
Pavlova-9 [17]

Answer:

See Explanation

Explanation:

Given

See attachment 1 for proper table definition

To answer this question, one of the basic sql commands (the "create" command) will be used to create the required table, followed by the fields of the table.

<em>I could not submit my answer directly. So, I added two additional attachments which represent the answer section and the explanation section, respectively.</em>

3 0
3 years ago
Other questions:
  • Lena has secured her online website, which sells fashion apparel. She has taken all the necessary steps by making her website PS
    8·1 answer
  • For a panoramic photograph, you will more than likely want to control the exposure of the photograph yourself rather than lettin
    11·1 answer
  • During the analysis phase of the SDLC the systems analyst will decide how the hardware, software and network infrastructure, use
    5·1 answer
  • The code segment below is intended to randomly print one of the values 2, 4, 6, or 8 with equal probability.
    12·1 answer
  • Consider the following high-level recursive procedure: long long int flong long int n, long long int k long long int b b k+2; if
    9·1 answer
  • Given an int variable n that has already been declared and initialized to a positive value, and another int variable j that has
    9·1 answer
  • When registering online for your classes you log onto to a website provided by your university. The computer and web browser tha
    6·2 answers
  • Cuales son las funcione basica de la computadora​
    9·1 answer
  • What would the math equation x = y create?
    9·1 answer
  • Peer collaboration helps develop critical-thinking skills, which is the ability to
    9·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!