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

Other questions on the subject: Engineering

image
Engineering, 04.07.2019 18:10, xboxdude06
Slip occurs via two partial dislocations because of (a) the shorter path of the partial dislocation lines; (b) the lower energy state through partial dislocations; (c) the charge balance.
Answers: 1
image
Engineering, 04.07.2019 18:20, kodyclancy
Aquick transition of the operating speed of a shaft from its critical speed will whirl amplitude. (a) increase (b) limit (c) not affect (d) zero
Answers: 2
image
Engineering, 04.07.2019 19:10, Mimidj9279
The sum of the normal stresses does not change as the stress state rotates through an angle. a)-trune b)- false
Answers: 2
image
Engineering, 04.07.2019 19:10, kimmy6973
What is creep? what is stress relaxation?
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 in other subjects: