I am doing the Cash(less) problem in CS50 and my code will not print the number of coins that I have
I tried moving print into a do while loop but that made it print forever.
do
{
for(int f = money;f >=0;f++)
{
for(q=0; money >= .25;q++)
{
money = money - .25;
}
for(d=0; money >= .10;d++)
{
money = money - .1;
}
for(n=0; money >= .05;n++)
{
money = money - .05;
}
for(p=0; money >= .01;p++)
{
money = money - .01;
}
}
}while(money>=0);
coins = q+d+n+p;
printf("%f", coins);
It should print the minimum number of coins required to return change to a customer based on the input they put in earlier in the code.