Can you please, help with some dvice: greedy stops working after it turns dollars into cents - how can I make the link between the functions? My code looks like that so far:
#include <cs50.h>
#include <stdio.h>
#include <math.h>
int main(void)
{
int cents = 0;
int count = 0;
printf("How much change is owed:\n");
float amount = GetFloat();
cents = (int)round(amount*100);
if(cents > 0)
{
while(cents > 25)
count++;
{
while((cents-25) > 10)
count++;
{
printf("You get %d coins!\n", count);
}
}
}
else
{
printf("please, give a positive value:\n");
}
return 0;
}
I did it only for 25 and 10 cents as I need to find the bug first, maybe I am on entirely wrong route....