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 aperture of the human eye and why
AveGali [126]

answer to the google

i didn't knew it but i need points

7 0
3 years ago
Computer industries and organizations also face issues related to health, safety, and environmental issues. In this task, you wi
Pavel [41]

Answer:

"(Answers may vary.)

Your essay should detail the issues related to health, safety, and the environment. It should include the following points:

personal health and safety

issues related to ergonomics

health issues when working with computers, such as eyestrain, muscle pain, and so on

safety issues such as power surges, electric shock, and so on

environmental issues such as pollution caused by electricity consumption

e-waste and technology-related waste

use of non-renewable resources in production

Then write about the ways in which these issues are handled. Cover these points:

implementation of ergonomic designs

safety precautions

health-conscious design

recycling of waste and non-wasteful usage of resources

energy-efficient design"

Explanation:

5 0
3 years ago
Which of the following describes the ways organisms are interconnected through their feeding patterns?
quester [9]
The answer is food web.
4 0
3 years ago
Read 2 more answers
Many people describes computers as complex machine. what can this mean?
Airida [17]
They work in many different ways?
8 0
3 years ago
Which phrase best describes a spreadsheet? A. a table designed to help with numerical data B. a table designed to help with text
kakasveta [241]
A spreadsheet does both so it is letter choice c
3 0
3 years ago
Other questions:
  • In this scenario, two friends are eating dinner at a restaurant. The bill comes in the amount of 47.28 dollars. The friends deci
    7·2 answers
  • 3. SmartArt can be used to create that highlight relationships between two items.
    15·1 answer
  • A mobile device you are troubleshooting is experiencing a sharp decrease in performance after an hour of operation. The user pow
    9·1 answer
  • Over the past three hours the pressure has been steadily increasing at a rate of what
    6·1 answer
  • Which of the following is not a hazard a driver might encounter?
    5·1 answer
  • When making an assembly of design what command is most.commonly used?
    15·1 answer
  • Write a python program that requests a positive integer from the user, determines if it is a composite, a prime or neither prime
    8·1 answer
  • If your microwave oven is a computer, define its Operating System and User Interface.
    12·1 answer
  • How can I download music and films at home without breaking the law?
    11·2 answers
  • to allow excel to change the cell references in a formula or function from row to row or column to column as you fill with it, y
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!