can someone tell me why my code doesn't output properly?
include <stdio.h>
include <cs50.h>
include <math.h>
int main(void) { int dollars; do { dollars = get_float("Change owed: "); } while (dollars < 0);
int cents = round(dollars * 100);
int coins = 0;
while (cents >= 25)
{
cents -= 25;
coins++;
}
while (cents >= 10)
{
cents -= 10;
coins++;
}
while (cents >= 5)
{
cents -= 5;
coins++;
}
while (cents >= 1)
{
cents -= 1;
coins++;
}
printf("%i\n", coins);
}
# include <stdio.h>
# include <cs50.h>
# include <math.h>
int main(void)
{
int dollars;
do
{
dollars = get_float("Change owed: ");
}
while (dollars < 0);
int cents = round(dollars * 100);
int coins = 0;
while (cents >= 25)
{
cents -= 25;
coins++;
}
while (cents >= 10)
{
cents -= 10;
coins++;
}
while (cents >= 5)
{
cents -= 5;
coins++;
}
while (cents >= 1)
{
cents -= 1;
coins++;
}
printf("%i\n", coins);
}