Advertisement
Thiagofsr

1021 NOTES and COINS

Feb 12th, 2016
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.10 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <math.h>
  3.  
  4.  
  5. int main()
  6. { float N;
  7. scanf ("%f", &N);
  8. N *= 100;
  9. // Com notas
  10. int N1, restoi, V1;
  11. N1= (int) N;
  12.  
  13. printf("NOTAS:\n");
  14.  
  15. V1 = N1/10000 ;
  16. restoi = V1%10000 ;
  17. printf("%i nota(s) de R$ 100.00\n", V1);
  18.  
  19. V1 = restoi/5000;
  20. restoi %= 5000;
  21. printf("%i nota(s) de R$ 50.00\n", V1);
  22.  
  23. V1 = restoi/2000;
  24. restoi %=2000;
  25. printf("%i nota(s) de R$ 20.00\n", V1);
  26.  
  27. V1 = restoi/1000;
  28. restoi %= 1000;
  29. printf("%i nota(s) de R$ 10.00\n", V1);
  30.  
  31. V1 = restoi/500 ;
  32. restoi %= 500 ;
  33. printf("%i nota(s) de R$ 5.00\n", V1);
  34.  
  35. V1 = restoi/200;
  36. restoi %= 200;
  37. printf("%i nota(s) de R$ 2.00\n", V1);
  38.  
  39. //Com moedas
  40.  
  41. printf("MOEDAS:\n");
  42.  
  43. V1 = restoi/100;
  44. restoi%=100;
  45. printf("%i moeda(s) de R$ 1.00\n", V1);
  46.  
  47. V1 = restoi/50;
  48. restoi %= 50;
  49. printf("%i moeda(s) de R$ 0.50\n", V1);
  50.  
  51. V1 = restoi/25;
  52. restoi %= 25;
  53. printf("%i moeda(s) de R$ 0.25\n", V1);
  54.  
  55. V1 = restoi/10;
  56. restoi %= 10;
  57. printf("%i moeda(s) de R$ 0.10\n", V1);
  58.  
  59. V1 = restoi/5;
  60. restoi %= 5;
  61. printf("%i moeda(s) de R$ 0.05\n", V1);
  62.  
  63. V1 = restoi/1;
  64. printf("%i moeda(s) de R$ 0.01\n", V1);
  65.  
  66.  
  67. return 0;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement