Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int main(void)
- {
- float change = -0.1;
- int i = 0;
- do {
- printf("O hai! How much change is owed? ");
- scanf("%f", &change);
- }while(change <= -0.1);
- for (i = 0; change > 0.00; i++) {
- if(change >= 0.25)
- change -= 0.25;
- else if(change >= 0.10)
- change -= 0.10;
- else if(change >= 0.05)
- change -= 0.05;
- else change -= 0.01;
- }
- printf("%d\n", i);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement