Advertisement
Guest User

Untitled

a guest
Mar 28th, 2017
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.33 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <math.h>
  3. #include <stdlib.h>
  4.  
  5. int main () {
  6.  
  7.     int ced100 , ced50 , ced20 , ced10 , ced5 , ced2 , moe1 , moe50 , moe25 , moe10 , moe5 , moe01;
  8.     double N;
  9.  
  10.     scanf("%lf" , &N );
  11.  
  12.     ced100 = N / 100.0;
  13.     N = N - ( ced100 * 100.0 );
  14.     ced50 = N / 50.0;
  15.     N = N - ( ced50 * 50.0 );
  16.     ced20 = N / 20.0;
  17.     N = N - ( ced20 * 20.0 );
  18.     ced10 = N / 10.0;
  19.     N = N - ( ced10 * 10.0 );
  20.     ced5 = N / 5.0;
  21.     N = N - ( ced5 * 5.0 );
  22.     ced2 = N / 2.0;
  23.     N = N - ( ced2 * 2.0 );
  24.     moe1 = N / 1.0;
  25.     N = N - ( moe1 * 1.0 );
  26.     moe50 = N / 0.50;
  27.     N = N - ( moe50 * 0.50 );
  28.     moe25 = N / 0.25;
  29.     N = N - ( moe25 * 0.25 );
  30.     moe10 = N / 0.10;
  31.     N = N - ( moe10 * 0.10 );
  32.     moe5 = N / 0.05;
  33.     N = N - ( moe5 * 0.05 );
  34.     moe01 = N / 0.01;
  35.  
  36.     printf("NOTAS:\n");
  37.     printf("%d nota(s) de R$ 100,00\n" , ced100);
  38.     printf("%d nota(s) de R$ 50,00\n" , ced50);
  39.     printf("%d nota(s) de R$ 20,00\n" , ced20);
  40.     printf("%d nota(s) de R$ 10,00\n" , ced10);
  41.     printf("%d nota(s) de R$ 5,00\n" , ced5);
  42.     printf("%d nota(s) de R$ 2,00\n" , ced2);
  43.     printf("MOEDAS:\n");
  44.     printf("%d moeda(s) de R$ 1,00\n" , moe1);
  45.     printf("%d moeda(s) de R$ 0,50\n" , moe50);
  46.     printf("%d moeda(s) de R$ 0,25\n" , moe25);
  47.     printf("%d moeda(s) de R$ 0,10\n" , moe10);
  48.     printf("%d moeda(s) de R$ 0,05\n" , moe5);
  49.     printf("%d moeda(s) de R$ 0,01\n" , moe01);
  50.  
  51.     return 0;
  52. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement