Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <math.h>
- #include "cs50.h"
- int main(void)
- {
- float n;
- int count = 0.0, amount;
- do
- {
- printf("Change Owed:\n");
- n = GetFloat();
- }
- while (n > 0.0);
- n *= 100.0;
- amount = (int) round(n);
- while (amount >= 25)
- {
- count++;
- amount -= 25;
- }
- while (amount >= 10)
- {
- count++;
- amount -= 10;
- }
- while (amount >= 5)
- {
- count++;
- amount -= 5;
- }
- while (amount >= 1)
- {
- count++;
- amount -= 1;
- }
- printf("%d\n", count);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement