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
Apart from the OOPs concepts learned in this lesson, identify additional concepts and write an essay on their functions. Explain
patriot [66]

Explanation:

Object Oriented Programming (OOPS or OOPS for Object Oriented Programming System) is the most widely used programming paradigm today. While most of the popular programming languages are multi-paradigm, the support to object-oriented programming is fundamental for large projects. Of course OOP has its share of critics. Nowadays functional programming seems the new trendy approach. Still, criticism is due mostly to misuse of OOP.

6 0
3 years ago
Writing down your main ideas, subpoints, and supporting material, then using geometric shapes and arrows to indicate logical rel
horsena [70]

The process that involves writing down your main ideas, subpoints, and supporting material, then using geometric shapes is mapping.

This includes uses of  arrows to indicate logical relationships.

<h3>What is mapping?</h3>

mapping can be regarded as the prescribed way of assigning an object to each object in one set a particular object.

Learn more about mapping at:

brainly.com/question/25168859

7 0
3 years ago
The main activity area or the brain of the computer is called the ________
Darya [45]

Motherboard

Its a computer chip



6 0
3 years ago
Write 'T' for true and 'F' for false statements.
asambeis [7]
1-F
2-T
3-F
4-F
5-F
6 T
7-T
3 0
2 years ago
The best ways to navigate through your computer? a)Start button b)My Computer c)Windows explorer d)All of the above​
melomori [17]

Answer:

d all of above cause from tht all we can navigate through our pc

7 0
3 years ago
Other questions:
  • __________ offers a mechanism to accomplish four security goals: confidentiality, integrity, authentication, and nonrepudiation.
    9·1 answer
  • Assume the availability of class named DateManager that provides a static method, printTodaysDate, that accepts no arguments and
    11·1 answer
  • A palindrome is a word or phrase that reads the same both backward and forward. The word ""racecar"" is an example. Create an al
    15·1 answer
  • Callie Crystal owns and operates one of the most successful local coffee shops in Denver, called The Edgewater Café. Each time a
    5·2 answers
  • You have created a PivotChart showing sales by quarter by sales rep. Before presenting it to management, you notice thename of a
    7·1 answer
  • FIRST TO Answer for free brainlest. GOG GOGOGO
    6·1 answer
  • El botón de layout se usa para <br>​
    8·1 answer
  • Write the technical terms for the following statements: The repeated working capacity of computer.
    15·1 answer
  • View One | View All
    10·1 answer
  • 2. How can Tailwind Traders ensure applications use geo-redundancy to create highly available storage applications?
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!