When I try to run my code, I get prompted for the change amount, as desired, but when I enter an amount, nothing else appears in the terminal and the program does not calculate the minimum number of coins as it should. I suspect the problem is related to my do-while loop, but I'm not sure and don't know how to fix it. My code is below. Thanks in advance.
int main(void)
{
int coin_count = 0;
float amount;
do
{
printf("How much change is owed (amount must be non-negative): \n");
amount = get_float();
}
while(amount < 0);
int cent_amount = round(amount*100);
while(cent_amount>=0)
{
if(cent_amount > 25)
{
cent_amount = cent_amount - 25;
coin_count++;
}
else if(cent_amount > 10)
{
cent_amount = cent_amount - 10;
coin_count++;
}
else if(cent_amount > 5)
{
cent_amount = cent_amount - 5;
coin_count++;
}
else if(cent_amount > 1)
{
cent_amount = cent_amount - 1;
coin_count++;
}
}
printf("Minimum number of coins used: %i\n", coin_count);
}