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, 04.07.2019 18:10
Refrigerant 134a enters an insulated compressor operating at steady state as saturated vapor at -26°c with a volumetric flow rate of 0.18 m3/s. refrigerant exits at 9 bar, 70°c. changes in kinetic and potential energy from inlet to exit can be ignored. determine the volumetric flow rate at the exit, in m3/s, and the compressor power, in kw.
Answers: 1
question
Engineering, 04.07.2019 18:10
The drive force for diffusion is 7 fick's first law can be used to solve the non-steady state diffusion. a)-true b)-false
Answers: 1
question
Engineering, 04.07.2019 19:10
Estimate the change in specific internal energy au and specific enthalpy h from inlet to outlet for ethylene glycol (a liquid) flowing through each of the following devices: (a) a heat exchanger where the glycol temperature increases from 20 °c to 80 °c; (b) a pump operating at about 25 °c and increasing the glycol pressure from 100 kpa to 8 mpa.
Answers: 2
question
Engineering, 04.07.2019 19:10
Starting wih an energy balance on a rectangular volume element, derive the one- dimensional transient heat conduction equation for a plane wall with constant thermal conductivity and no heat generation.
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
Mathematics, 10.09.2019 15:10
question
Mathematics, 10.09.2019 15:10
question
Mathematics, 10.09.2019 15:10
Questions on the website: 13722360