Advertisement
Thiagofsr

NOTES and COINS 2

Feb 12th, 2016
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.88 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <math.h>
  3.  
  4.  
  5. int main()
  6. { int N1, N2;
  7. scanf ("%d.%d", &N1, &N2);
  8. // Com notas
  9.  
  10. printf("NOTAS:\n");
  11.  
  12.     printf("%i nota(s) de R$ 100.00\n", N1/100 );
  13.  
  14.     printf("%i nota(s) de R$ 50.00\n", (N1%100)/50);
  15.  
  16.     printf("%i nota(s) de R$ 20.00\n", (N1%100)%50/20);
  17.  
  18.     printf("%i nota(s) de R$ 10.00\n", (N1%100)%50%20/10);
  19.  
  20.     printf("%i nota(s) de R$ 5.00\n",(N1%100)%50%20%10/5);
  21.  
  22.     printf("%i nota(s) de R$ 2.00\n", (N1%100)%50%20%10%5/2);
  23.  
  24. //Com moedas
  25.  
  26. printf("MOEDAS:\n");
  27.  
  28.  
  29.     printf("%i moeda(s) de R$ 1.00\n", (N1%100)%50%20%10%5%2/1);
  30.  
  31.     printf("%i moeda(s) de R$ 0.50\n", N2/50);
  32.  
  33.     printf("%i moeda(s) de R$ 0.25\n", (N2%50)/25);
  34.  
  35.     printf("%i moeda(s) de R$ 0.10\n", (N2%50)%25/10);
  36.  
  37.     printf("%i moeda(s) de R$ 0.05\n", (N2%50)%25%10/5);
  38.  
  39.     printf("%i moeda(s) de R$ 0.01\n", (N2%50)%25%10%5/1);
  40.  
  41.  
  42. return 0;
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement