# PSet1 - Greedy - infinite loop? no check50 errors [duplicate]

I am still having trouble getting past greedy! Not sure why I'm still getting hung up after the prompt. It feels like an infinite loop, which I tried fixing after some earlier advice. check50 shows no errors at this point.

``````#include <stdio.h>
#include <cs50.h>
#include <math.h>

int main(void)
{
int input;
int coins = 0;
int counter1 = 0;
int counter2 = 0;
int counter3 =0;
int counter4 = 0;
int quarters, dimes, nickels, pennies;
int remaining = 0;

printf("O hai! How much change is owed?");
input = GetFloat();
int cents = round(input * 100);

for ( ; cents >= 25; cents--)
{
quarters = (cents/25);
counter1 = quarters;
remaining = (cents % quarters);
}

for ( ;remaining >= 10 || remaining <= 24; remaining--)
{
dimes = (remaining/10);
counter2 = dimes;
remaining = (remaining % 10);
}

for ( ; remaining >= 5 || remaining <= 9; remaining--)
{
nickels = (remaining/5);
counter3 = nickels;
remaining = (remaining % 5);
}

for ( ; remaining >=1 || remaining <= 4; remaining--)
{
pennies = (remaining/1);
counter4 = pennies;
remaining = (remaining % 1 );
}

coins = (counter1 + counter2 + counter3 + counter4);

printf("%d.2\n", coins);

}
``````
• Please don't open a new question just to bring attention to a problem you have already asked about. – Air Dec 2 '14 at 18:18