I am inputting 0.26 into cash.c, and after the first do while loop in my program, f = 0.00999999046
My second do while loop condition is f >= 0.10, yet it is executed even though f is less than that. Whats wrong?
#include <stdio.h>
#include <cs50.h>
int main(void)
{
float f = get_float();
int c = 0;
do
{
f = f - 0.25;
c++;
}
while (f >= 0.25);
do
{
f = f - 0.10;
c++;
}
while (f >= 0.10);
do
{
f = f - 0.05;
c++;
}
while (f >= 0.05);
do
{
f = f - 0.01;
c++;
}
while (f >= 0.01);
printf("%i\n", c);
}