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
To create a datetime object for the current date and time, you can use theGroup of answer choicestoday() method of the date clas
SVEN [57.7K]

var theDate = new DateTime (DateTime.Today.Year, DateTime.Today.Month, DateTime.Today.Day, hours, minute, second);

6 0
2 years ago
What does a virus do to a computer? How can it be fixed?
miv72 [106K]
A virus can do many things from burn up your hard drive to just annoy you with ads. the best thing you can do if you think you have one is take it to a professional
4 0
2 years ago
Can someone help me calculate this Multimedia math:
IRISSAK [1]

Answer:

I will try to help you answer this. it seems really confusing but I'll do my best to solve it and get it back to you. Hope I'm able to help!

5 0
3 years ago
How to prevent water pollution​
loris [4]

Answer:

Here is your answer

Explanation:

1. pick up litter and throw it away in a garbage can.

2. use environmentally household products such as washing powder, household cleaning agents

3. wash your car or outdoor equipment where it can flow to a gravel or grassed area instead of a street.

4. don't throw waste at ocean it will harm the animals and create tocsin.

6 0
2 years ago
Your customer asks you if it would be worth the investment for him to have Ethernet cabling installed to reach each of his works
Helen [10]

Answer:

Yes

Explanation:

Depending on the ethernet standard used, the IEEE 802.3 is faster than the WIFI (IEEE 802.11ac).

The ethernet protocol on cabled networks are of different speed based on ethernet standard which ranges from 10 Mega-bits to 100 Giga-bits per second. This protocol is found in the physical layer of the OSI model.

The wifi 802.11ac also known as wifi 5 is a wireless connection medium in the physical layer of the OSI model. It has a range of aggregate speed capacity of  433 mega-bits per second to 6.77 giga-bits per second.

5 0
3 years ago
Other questions:
  • Give the difference betewen recursion and interation in C. Sight what are the advantages and their disadvantages?
    7·1 answer
  • The function below takes a single parameter number_list which is a list that can contain integers and floats. Complete the funct
    9·1 answer
  • To see a custom, object-specific action on the palette of the page layout editor: A. Click Layout Properties on the page layout
    11·1 answer
  • The fundamental difference between a switch and a router is that a switch belongs only to its local network and a router belongs
    10·1 answer
  • Virtual private network requires a secure remote connections<br><br> true or false?
    11·1 answer
  • Cual es la herramienta de google que funciona como oficce ?
    11·1 answer
  • Apex
    5·2 answers
  • I have been charged for brainly plus yet I still have to watch ads why? What do I do?
    12·2 answers
  • Gray London is a retired race car driver who helped Dale Earnhardt, Jr. get his start. He is writing a book and making a video a
    9·1 answer
  • The advancements in which of the following technologies has most changed the American job market in recent years?
    14·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!