0

So I was trying to start off my greedy code with a simple part thereof... I am trying to simple get a float... then if it is more than 25 cents, subtract 25 cents from it, and add 1 to my count... then return the count of quarters. It won't work... for some reason the count is always 1. Can you explain to me why?

int main(void)
{
    int money;
    int count=0;
    do
    {
        printf("How much money you got?\n");
        money = GetFloat();
    }
    while (money < 0);

    do
    {
        money = money - 0.25;
        count = count+1;
    }
    while(money > 0.25);
    printf("You get %i quarters\n", count); 
}
2
  • do you think the type of money has something to do with this?
    – kzidane
    Jun 20, 2015 at 18:33
  • ahh yes of course i need to make it a float! I'm so bad at this!
    – alex1x
    Jun 20, 2015 at 18:35

0

You must log in to answer this question.

Browse other questions tagged .