Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <cs50.h>
- #include <math.h>
- int main(void)
- {
- float n;
- int count;
- do
- {
- printf("O hai! How much change is owed?\n");
- n = get_float();
- }
- while (n < 0);
- int iznos = round(n*100);
- count=0;
- while (iznos >= 25)
- {
- count++;
- iznos -= 25;
- }
- while (iznos >= 10)
- {
- count++;
- iznos -= 10;
- }
- while (iznos >= 5)
- {
- count++;
- iznos -= 5;
- }
- while (iznos >= 1)
- {
- count++;
- iznos -= 1;
- }
- printf("%d\n", count);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement