Advertisement
Guest User

Untitled

a guest
May 25th, 2018
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.32 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. int main() {
  4. int n100, n50, n20, n10, n5, n2;
  5. int m1, m50, m25, m10, m05, m01;
  6. double n;
  7.  
  8. scanf("%lf", &n);
  9. int notas = n;
  10. int moedas = (n - notas) * 100;
  11.  
  12.  
  13. n100 = notas/100;
  14. notas = notas%100;
  15. n50 = notas/50;
  16. notas = notas%50;
  17. n20 = notas/20;
  18. notas = notas%20;
  19. n10 = notas/10;
  20. notas = notas%10;
  21. n5 = notas/5;
  22. notas = notas%5;
  23. n2 = notas/2;
  24. notas = notas%2;
  25.  
  26. m1 = notas/1;
  27. notas = notas%1;
  28. m50 = moedas/50;
  29. moedas = moedas%50;
  30. m25 = moedas/25;
  31. moedas = moedas%25;
  32. m10 = moedas/10;
  33. moedas = moedas%10;
  34. m05 = moedas/5;
  35. moedas = moedas%5;
  36. m01 = moedas/1;
  37.  
  38. printf("NOTAS:\n");
  39.  
  40. printf("%d nota(s) de R$ 100.00\n", n100);
  41. printf("%d nota(s) de R$ 50.00\n", n50);
  42. printf("%d nota(s) de R$ 20.00\n", n20);
  43. printf("%d nota(s) de R$ 10.00\n", n10);
  44. printf("%d nota(s) de R$ 5.00\n", n5);
  45. printf("%d nota(s) de R$ 2.00\n", n2);
  46.  
  47. printf("MOEDAS:\n");
  48.  
  49. printf("%d moeda(s) de R$ 1.00\n", m1);
  50. printf("%d moeda(s) de R$ 0.50\n", m50);
  51. printf("%d moeda(s) de R$ 0.25\n", m25);
  52. printf("%d moeda(s) de R$ 0.10\n", m10);
  53. printf("%d moeda(s) de R$ 0.05\n", m05);
  54. printf("%d moeda(s) de R$ 0.01\n", m01);
  55.  
  56. return 0;
  57. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement