I am trying to build CS50 PSET 1 problem: CASH with a for loop, but I am not getting any result
Kindly help me understand issues with my code
#include
#include "cs50.h"
int main(void)
{
int cents;
do
{
cents = get_int("Cash owed (in cents): ");
} while (cents < 0);
int quarter, dime, nickel, penny;
for (quarter = 0; cents>=25; quarter++)
{
cents = cents - 25;
}
return quarter;
for (dime = 0; cents>=10; dime++)
{
cents = cents - 10;
}
return dime;
for (nickel = 0; cents>=5; nickel++)
{
cents = cents - 5;
}
return nickel;
for (penny = 0; cents>=1; penny++)
{
cents = cents - 1;
}
return penny;
int coins = quarter + dime + nickel + penny;
printf("Total coins %i: ", coins);
}
I expected it to give no of coins but instead the program does not move forward after obtaining user input.