Advertisement
N1K003

Untitled

Aug 13th, 2016
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.60 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. int main(void)
  4. {
  5.         float change = -0.1;
  6.         int i = 0;
  7.         do {
  8.                 printf("O hai! How much change is owed? ");
  9.                 scanf("%f", &change);
  10.         }while(change <= -0.1);
  11.  
  12.         for (i = 0; change > 0.00; i++) {
  13.                 if(change >= 0.25)
  14.                         change -= 0.25;
  15.                 else if(change >= 0.10)
  16.                         change -= 0.10;
  17.                 else if(change >= 0.05)
  18.                         change -= 0.05;
  19.                 else change -= 0.01;
  20.         }
  21.         printf("%d\n", i);
  22.  
  23. return 0;
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement