Advertisement
ismail5g

URI 1021

Mar 31st, 2018
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.96 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. int main()
  5. {
  6.     double n;
  7.  
  8.     int x, y;
  9.  
  10.     scanf("%lf", &n);
  11.  
  12.     x = (int)n;
  13.  
  14.     y=(n-x)*100;
  15.  
  16.     printf("NOTAS:\n");
  17.  
  18.     printf("%d nota(s) de R$ 100.00\n", x/100);
  19.  
  20.     x%=100;
  21.  
  22.     printf("%d nota(s) de R$ 50.00\n", x/50);
  23.  
  24.     x%=50;
  25.  
  26.     printf("%d nota(s) de R$ 20.00\n", x/20);
  27.  
  28.     x%=20;
  29.  
  30.     printf("%d nota(s) de R$ 10.00\n", x/10);
  31.  
  32.     x%=10;
  33.  
  34.     printf("%d nota(s) de R$ 5.00\n", x/5);
  35.  
  36.     x%=5;
  37.  
  38.     printf("%d nota(s) de R$ 2.00\n", x/2);
  39.  
  40.     x%=2;
  41.  
  42.     y=y+(x*100);
  43.  
  44.     printf("MOEDAS:\n");
  45.  
  46.     printf("%d moeda(s) de R$ 1.00\n", y/100);
  47.  
  48.     y%=100;
  49.  
  50.     printf("%d moeda(s) de R$ 0.50\n", y/50);
  51.  
  52.     y%=50;
  53.  
  54.     printf("%d moeda(s) de R$ 0.25\n", y/25);
  55.  
  56.     y%=25;
  57.  
  58.     printf("%d moeda(s) de R$ 0.10\n", y/10);
  59.  
  60.     y%=10;
  61.  
  62.     printf("%d moeda(s) de R$ 0.05\n", y/5);
  63.  
  64.     y%=5;
  65.  
  66.     printf("%d moeda(s) de R$ 0.01\n", y/1);
  67.  
  68.     return 0;
  69. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement