/** * greedy.c * * Andi Peng * Section, Week 3 * * Demonstrates how to debug a program using gdb */ #include #include #include int main(void) { float n; do { printf("O hai! How much change is owed?\n"); n = GetFloat(); } while (n < 0); int cents = round(n * 100); int coins = 0; coins += cents / 25; cents = cents % 25; coins += cents / 10; cents = cents % 10; coins += cents / 5; cents = cents % 5; coins += cents; printf("%i\n", coins); }