I changed all the "remaining" to cents and its didn't work. I still can't see the logic why I made the made the change. I want to understand this. Here is my code:
#include <cs50.h>
include
include
int main(void)
{ float change = 0; int q = 25; int d = 10; int n = 5; int cents = 0; int final_coin_count = 0;
do { printf("How much change is owed "); change = get_float(); if (change < 0 || change == 0) printf ("You can not have less than zero change \n"); }
while (change <= 0);
int cents = round(change * 100);
int quarter_count = (cents / q);
cents = cents % q;
int dime_count = (cents / d);
cents = cents % d;
int nickel_count = (cents / n);
cents = cents % n;
final_coin_count = quarter_count + dime_count + nickel_count + cents;
{ printf("%i\n", final_coin_count);
}
}