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
The IT department sent out a memo stating that it will start delivering desktop computer interfaces through the IT data center v
Tasya [4]

Answer: Virtual desktop infrastructure

Explanation:

The virtual desktop infrastructure is the virtualization technology in which the host desktop OS (operating system)  is in the centralized server of the data center. The virtual desktop infrastructure is also known as server based computing as it include the variation in the computing model such as client - server model.

The example of the virtual desktop infrastructure is wallpapers, toolbars, window and folder is the stored in the server remotely.

All the other options does not involve with this technology so that is why option (D) is correct.

4 0
3 years ago
The following equations estimate the calories burned when exercising (source): Men: Calories = ( (Age x 0.2017) — (Weight x 0.09
sammy [17]

In python:

age = float(input("How old are you? "))

weight = float(input("How much do you weigh? "))

heart_rate = float(input("What's your heart rate? "))

time = float(input("What's the time? "))

print("The calories burned for men is {}, and the calories burned for women is {}.".format(

   ((age * 0.2017) - (weight * 0.09036) + (heart_rate * 0.6309) - 55.0969) * (time / 4.184),

   ((age * 0.074) - (weight * 0.05741) + (heart_rate * 0.4472) - 20.4022) * (time / 4.184)))

This is the program.

When you enter 49 155 148 60, the output is:

The calories burned for men is 489.77724665391963, and the calories burned for women is 580.939531548757.

Round to whatever you desire.

6 0
3 years ago
Write a program that reads in a temperature value in °F. Create a function ConvertFahrenheit that takes that value as a paramete
larisa86 [58]

Answer:

#include<stdio.h>

void ConvertFahrenheit(float);

void main()

{

float fahrenheit_temp;

printf("Input the temperature in Fahrenheit: ");

 

scanf("%f", &fahrenheit_temp);

 

ConvertFahrenheit(fahrenheit_temp);

}

void ConvertFahrenheit(float fahren) {

float c, k;

 

c = (fahren - 32)/1.8;

k = (fahren + 459.67)/1.8;    

 

printf("Celsius = %f\n", c);

printf("Kelvin = %f", k);

}

Explanation:

  • Inside the main function, take the temperature in Fahrenheit as an input from user and call the ConvertFahrenheit function by passing it the  fahrenheit_temp variable as an argument.
  • Create the ConvertFahrenheit function for the conversion  and convert the fahrenheit value to the Celsius and Kelvin by using their conversion formulas respectively.
  • Lastly, display the result in Celsius and Kelvin.
8 0
3 years ago
Warning or pop-up that convinces a user that his or her computer or mobile device is infected with a virus or other problem that
o-na [289]
Idk... just dont trust those pop-ups unless your device is acting weird.
3 0
3 years ago
I will give brainliest to the first person who can answer correctly.
Mariulka [41]
I think that the answer wiloukd be B. For #31 and for #32 A.
4 0
3 years ago
Other questions:
  • For a loop counter, the appropriate data type would be:
    14·1 answer
  • If you wish to maintain a consistent style to all the documents you create, it would be helpful to use a _____.
    10·1 answer
  • Switches operate on what layer of the OSI Model
    11·1 answer
  • Which of the following are the rows or columns of white space created between grids?
    7·1 answer
  • 1- Which of the following is the java keyword used to declare a class?
    5·2 answers
  • The natural language convention used to represent ip addresses is called the:
    15·1 answer
  • What does social protocol means in network?
    9·1 answer
  • . What type of device is a computer? Where does it use?​
    14·1 answer
  • Plz tell me how to get my deleted account back you will be highly PRAISED!!!!!!!!!!
    14·2 answers
  • How much would it cost to get the screen replaced on a Moto G7?
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!