Hello for this program that is meant to return the number of coins needed to give the change it works fine until the value goes between 0 and 0.05. When I input 0.01, the program does not go into the while loop at all (I checked by making something print at the start of the while loop). Why does it not run?
#include <stdio.h>
#include <cs50.h>
#include <math.h>
int main(void)
{
float change;
do {
change = get_float("Change owed: ");
}
while (change < 0);
int no = 0;
while (change >= 0.01) {
if (change >= 0.25) {
change = change - 0.25;
no = no + 1;
printf("a %f\n", change);
}
else if (change >= 0.1) {
change = change - 0.1;
no = no + 1;
printf("b %f\n", change);
}
else if (change >= 0.05) {
change = change - 0.05;
no = no + 1;
printf("c %f\n", change);
}
else if (change >= 0.01) {
change = change - 0.01;
no = no + 1;
printf("c %f\n", change);
}
};
printf("%i", no);
}