In the report of check50, everything goes smoothly except for one value: 4.2. The correct answer is 18 while my program output 22. Could you help me find out which part goes wrong? Here's my code. int main(void) { float x; do { x = get_float("Please type in a number here: "); } while (x < 0);
int n = 0;
int c = x * 100;
if (c >= 25)
{
n = c / 25;
c = c % 25;
}
else
{
}
if (c >= 10)
{
n = c / 10 + n;
c = c % 10;
}
else
{
}
if (c >= 5)
{
n = c / 5 + n;
c = c % 5;
}
else
{
}
n = c / 1 + n;
c = c % 1;
printf("%i\n", n);
}