im struggling with pset1 cash exercise, when im defining a calculate_quarters() and other in the same way i got an error. the task is to find out the number of quarters, dimes, nickels and pennies to reach owed cents. this is my code, im sure something is off with my loop. (im very new to the coding world so please explain as if im newborn)
int get_cents(void)
{
int cents;
do
{
cents = get_int("Change owed: ");
}
while (cents < 0);
return cents;
}
int calculate_quarters(int cents)
{
for(int quarters = 0; cents >= 25; quarters++);
{
cents = cents - 25
}
return quarters;
}
int calculate_dimes(int cents)
{
for(int dimes = 0; cents >= 10; dimes++);
{
cents = cents - 10;
}
return dimes;
}
int calculate_nickels(int cents)
{
for(int nickels = 0; cents >= 5; nickels++);
{
cents = cents - 5;
}
return nickels;
}
int calculate_pennies(int cents)
{
for(int pennies = 0; cents >= 5; penniess++);
{
cents = cents - 1;
}
return pennies;
}