Advertisement
Guest User

Untitled

a guest
Jan 23rd, 2020
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.85 KB | None | 0 0
  1. #define _CRT_SECURE_NO_WARNINGS
  2. #include <stdio.h>
  3. #include <stdlib.h>
  4.  
  5.  
  6.  
  7. int main()
  8. {
  9. int money = 0,another = 0,calc = 0;
  10.  
  11. printf("Enter how many money do you need now: ");
  12. scanf("%d",&money);
  13. if (money % 10 != 0 || money < 0)
  14. {
  15. printf("%d", -1);
  16. return -1;
  17. }
  18. printf("500 - %d\n", money / 500);
  19. calc += money / 500;
  20. another = money % 500;
  21. printf("200 - %d\n", another / 200);
  22. calc += another / 200;
  23. another = another % 200;
  24. printf("100 - %d\n", another / 100);
  25. calc += another / 100;
  26. another = another % 100;
  27. printf(" 50 - %d\n", another / 50);
  28. calc += another / 50;
  29. another = another % 50;
  30. printf(" 20 - %d\n", another / 20);
  31. calc += another / 20;
  32. another = another % 20;
  33. printf(" 10 - %d\n", another / 10);
  34. calc += another / 10;
  35. another = another % 10;
  36. printf("Money bills - %d\n", calc);
  37.  
  38. getchar();
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement