I'm trying to solve the less comfortable problem set of week1.
I believe I'm somewhat on the correct road (at least i can get a return number). From how I implemented my code, it seems that when I input the "change" float value, the while loops pass at least once but they don't reduce the "change" value correctly after each passage. I'm pasting my code for clarification.
#include <cs50.h>
#include <stdio.h>
int main (void)
{
float quarter = 0.25;
float dime = 0.10;
float nickel = 0.05;
float penny = 0.01;
int count = 0;
float change;
do {
printf ("O hai! How much change is owed?\n");
change = get_float();
}
while (change <0);
while (change>quarter){
count++;
change = change - quarter;
break;
}
while (change>dime) {
count++;
change= change - dime;
break;
}
while (change>nickel) {
count++;
change = change - nickel;
break;
}
while (change>penny) {
count++;
change = change - penny;
break;
}
printf ("%i\n", count);
}