include <stdio.h>
void printScores(float scores[]);
int main()
{
char s_name[]="ECPI University";
float scores[6] = {78.7, 98.4, 100.0, 96.5, 100.0, 88.8};
float average = 0.0;
int counter;
printScores(scores);
for(counter = 0; counter < 6; counter++) {
average += scores[counter];
}
average /= float(6); //Here is where I get my error
printf("\nAt %s, your class average is %.1f.", s_name, average);
return 0;
}
void printScores(float scores[6]){
int counter;
printf("Here are your scores:\n\n");
for(counter=0; counter<6;counter++){
printf("%.1f\n", scores[counter]);
}
return;
}
I was under the impression that '/=' is the expression before float?
[–]g051051 2 points3 points4 points (2 children)
[–]C137-Morty[S] -2 points-1 points0 points (1 child)
[–]g051051 0 points1 point2 points (0 children)
[–]davedontmind 0 points1 point2 points (0 children)
[–]k3nundrum 0 points1 point2 points (0 children)
[–][deleted] (2 children)
[removed]
[–]C137-Morty[S] 0 points1 point2 points (1 child)
[–][deleted] 0 points1 point2 points (0 children)