Question: #include int computeTotal ( int scores [ ] , int numHoles ) { / / this function will compute the total score int total =

#include
int computeTotal(int scores[], int numHoles){//this function will compute the total score
int total =0;
for (int i =0; i < numHoles; i++){
total += scores[i];
}
return total;
}
int main(){//
int numHoles =9;
int scores[9];
printf("Enter scores for each hole:
");//inpute the scores from each hole
for (int i =0; i < numHoles; i++){
printf("Hole %d: ", i +1);
scanf("%d", &scores[i]);
}
// Compute the total score using the computeTotal function
int totalScore = computeTotal(scores, numHoles);//Compute score using computeTotal function
printf("
Total Score: %d
", totalScore);//display the total scores
if(totalScore>30)//this if statement will determine if the golfer won..If more than 30 than he won
{
printf("YOU WON!!!! Congrats, but you will never beat Tiger Woods
");
}
else{
printf("YOU LOST!!!! Please continue practicing");
}
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 Programming Questions!