I don't understand why I keep getting an error message regarding the variable "amount." Can anyone identify/explain the problem and how to fix it? The relevant part of my code is below. Thanks in advance.
int main(void)
{
int coin_count = 0;
do
{
printf("How much change is owed (amount must be non-negative): \n");
float 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);
}