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
Makovka662 [10]
3 years ago
7

Modify an array's elements using other elements Write a for loop that sets each array element in bonusScores to the sum of itsel

f and the next element, except for the last element which stays the same. Be careful not to index beyond the last element. Ex: If bonusScores = [10, 20, 30, 40], then after the 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.
Computers and Technology
1 answer:
Igoryamba3 years ago
5 0

Answer:

The program to this question can be given as:

Program:

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

int main()

//main function

{

  int i;  //define variables.

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

   printf("Values:");  //message

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

{

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

}

for (i = 0; i <4; 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 < 4; ++i) //loop for print values

  {

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

  }

  printf("\n");

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 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. We use the second time in this loop we check array elements by using the condition statements in if block we add the elements and in else we print last value. At the last, we use the loop for print array.

You might be interested in
Renae wants to write a blog about her favorite sports stars. She wants the blog to be informative and visually appealing, so she
Usimov [2.4K]
To avoid copyright infringement, i would say that the best choice would be C. Hope this helps!
6 0
3 years ago
Read 2 more answers
Question: 11
levacccp [35]

Answer:

The detail answer to this question is given in the explanation section.

The correct answer is .info

Explanation:

Let look as each statement

p.info.important

this is a specific  because it says

go to important property which is inside info property  which is inside P

.info  is less specific

because it will go to .info No function is  given whose property is this.

p.info

This is some what specific. As it says select .info property which is inside p

4 0
3 years ago
OSI layer for HDLC??​
tresset_1 [31]

Answer:

HDLC is one of the most commonly used internet protocols (IP) in what is Layer 2 of the industry communication reference model called Open Systems Interconnection (OSI).

Explanation:

3 0
2 years ago
If you want to prioritize downloads of your mobile app instead of visits to your mobile site, you should: a) add a sitelink exte
scoray [572]

Answer:

create a Universal App campaign

3 0
2 years ago
This semester we looked at three languages (C++, Java and Python). One common rule in all three class checklists (for C++, Java
Marysya12 [62]

Answer:

The languages C++, Java, Python are Object Oriented Programming languages. What this means is that we create classes and then instantiate those classes. In C++ and Java, we use the new operator to instantiate the classes. So, if we want to display some data when we try to print the instance just like we print the variables of data types like int, double, string etc, we need to define what we need to display. It is because, class are just like data types like int, double etc. But as they are defined by the developer according to his/her needs, so the developer has to define what to print when they are printed.

5 0
3 years ago
Other questions:
  • Survey Q. Non-scoring: What role is played in the team? (1 correct answer)
    14·1 answer
  • An increase in Consumption will ___________ in the Classical Model of Aggregate Demand.
    13·1 answer
  • You want to enable nap so that all portal computers using wireless connections have an active firewall. which type of enforcemen
    11·1 answer
  • A typeface in which each character has the same width and is often used to display programming code is _
    8·1 answer
  • What term best describes the way the dns name space is organized?
    9·1 answer
  • Assuming that each of the resistors in the circuit shown in the figure above has a resistance value of 100 k ohms, what will be
    11·2 answers
  • Which of the following languages does not provide built-in-pattern matching operations (the language, although, has pattern matc
    14·1 answer
  • How do you remove management from your chrome book [administrator]
    12·1 answer
  • Does "remainder of x from y" mean xmody?
    5·1 answer
  • 4. The volume of a sphere is (4.0/3.0)rr3 and the surface area is 4.0rr2, where r is the radius of
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!