subject
Engineering, 18.11.2019 19:31 sosick3595

Write a loop that sets each array element to the sum of itself and the next element, except for the last element which stays the same. be careful not to index beyond the last element. ex:
initial scores: 10, 20, 30, 40
scores after the loop: 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.
sample output:
#include
int main(void) {
const int scores_size = 4;
int bonusscores[scores_size];
int i = 0;
bonusscores[0] = 10;
bonusscores[1] = 20;
bonusscores[2] = 30;
bonusscores[3] = 40;
/* your solution goes here */
for (i = 0; i < scores_size; ++i) {
printf("%d ", bonusscores[i]);
}
printf("\n");
return 0;
}

ansver
Answers: 3

Another question on Engineering

question
Engineering, 03.07.2019 15:10
Apiston-cylinder with a volume of 0.25 m3 holds 1 kg of air (r 0.287 k/kgk) at a temperature of 100 c. heat transfer to the cylinder causes an isothermal expansion of the piston until the volume triples. how much heat is added to the piston-cylinder?
Answers: 3
question
Engineering, 04.07.2019 18:10
Determine whether or not it is possible to compress air adiabatically from k to 140 kpa and 400 k. what is the entropy change during this process?
Answers: 3
question
Engineering, 04.07.2019 18:10
Journeyman training is usually related (clo2) a)-to specific tasks b)-to cost analysis of maintenance task c)-to control process to ensure quality d)-to installation of machinery
Answers: 2
question
Engineering, 04.07.2019 18:20
Along 8-cm diameter steam pipe whose external surface temperature is 900c connects two buildings. the pipe is exposed to ambient air at 70c with a wind speed of 50 km/hr blowing across the pipe. determine the heat loss from the pipe per unit length. (b) air at 500c enters a section of a rectangular duct (15 cm x 20 cm) at an average velocity of 7 m/s. if the walls of the duct are maintained at 100c. a) the length of the tube for an exit temperature of the air to be 40 0c. b)the rate of heat transfer from the air. c) the fan power needed to overcome the pressure drop in this section of the duct.
Answers: 1
You know the right answer?
Write a loop that sets each array element to the sum of itself and the next element, except for the...
Questions
question
English, 01.12.2020 19:30
question
Mathematics, 01.12.2020 19:30
question
Mathematics, 01.12.2020 19:30