The problem is that it works for some values and not for others even though the float value is rounded. pls help
{
float change;
do
{
change = get_float("change: ");
}
while (change < 0);
int coins = 0;
int cents = round (change * 100);
//here starts the action
if (cents > 25)
{
do
{
coins++;
cents = cents - 25;
}
while (cents > 24);
}
if (cents < 25 && cents > 10)
{
do
{
coins++;
cents = cents - 10;
}
while (cents > 9);
}
if (cents < 10 && cents > 5)
{
do
{
coins++;
cents = cents - 5;
}
while (cents > 4);
}
if (cents < 5 && cents > 1)
{
do
{
coins++;
cents = cents - 1;
}
while (cents > 0);
}
//here finishes the action
do
{
printf("you will need %i coins\n", coins);
}
while (false);
}````