So I've got the following code in C:
#include <stdio.h>
#include <stdlib.h>
int main()
{
printf("Please enter the heights of 3 players\n");
float average;
float height;
for (int i=0; i<3; i++)
{
scanf("%f", &height);
average+=height;
}
average = (float)((average + 2.06)/4);
if (average<1.900 || average>2.100) printf("Illegal heights average, your average %.3f isn’t approved\n",average);
else printf("Your heights average is %.3f, welcome to space jam tournament!!\n",average);
return 0;
}
Now, for most tests, it works just fine, however one test continually fails:
I'm completely baffled by it. Maybe it has something to do with the float variables? Would be glad for someone to help me out with this. Thanks ahead :)