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 12:10
On a average work day more than work place firs are reorted
Answers: 1
question
Engineering, 04.07.2019 18:10
Shafts are machine elements that are used to a) carry axial loads b) direct shear loads c) transmit power d) rotate at constant speed e) none of the above circular and square shafts subjected to the same torque under the same circum behave a) the same way b) almost the same way
Answers: 2
question
Engineering, 04.07.2019 18:20
A2-m rigid tank initially contains saturated water vapor at 100 kpa. the tank is connected to a supply line through a valve. steam is flowing in the supply line at 600 kpa and 300 c. the valve is opened, and steam is allowed to enter the tank until the pressure in the tank reaches the line pressure, at which point the valve is closed. a thermometer placed in the tank indicates that the temperature at the final state is 200°c. determine (a) the mass of steam that has entered the tank (b) the amount of heat transfer.
Answers: 3
question
Engineering, 04.07.2019 19:10
How to increase the thermal officiency of an ideal simple rankino cycle? among these methods, which one is the best and why?
Answers: 2
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, 20.01.2021 18:20
question
Social Studies, 20.01.2021 18:20
question
Social Studies, 20.01.2021 18:20
Questions on the website: 13722365