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
The higher the astm grain-size number, the coarser the grain is. a)-true b)-false
Answers: 3
question
Engineering, 04.07.2019 18:10
Which from the following instrument is commonly used to detect the high pitch butzing sound in bearings? [clo4] a)-digital ultrasonic meter b)-infrared camera c)-spectroscopic d)-vibrometer
Answers: 2
question
Engineering, 04.07.2019 18:20
Acertain flow of air (at stp) has a velocity distribution given by v i (in ft/s). if this flow is going through a 4 ft square area in the yz-plane (centered at the origin), what is the mass flow rate (in lbm/s)?
Answers: 2
question
Engineering, 04.07.2019 19:10
What is a monomer? how do they form a ploymer from the view point of chemical bonding?
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, 07.02.2021 08:10
question
Mathematics, 07.02.2021 08:10
question
Social Studies, 07.02.2021 08:10
question
History, 07.02.2021 08:10
Questions on the website: 13722360