Question: Given the integer array dailyMiles with NUM _ ELEMENTS elements, write a for loop that assigns sumBonus with the total bonus. Each mile value above

Given the integer array dailyMiles with NUM_ELEMENTS elements, write a for loop that assigns sumBonus with the total bonus. Each mile value above 50 contains a bonus equal to the mile value minus 50.
Ex: If the input is 116108113156146, then the output is:
Bonus sum: 389
#include
int main(void){
const int NUM_ELEMENTS =5;
int dailyMiles[NUM_ELEMENTS];
int i;
int sumBonus;
for (i =0; i < NUM_ELEMENTS; ++i){
scanf("%d", &(dailyMiles[i]));
}
/* Your code goes here */
printf("Bonus sum: %d
", sumBonus);
return 0;
}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!