Advertisement
UMME_RUKAYA13

Untitled

Jul 19th, 2018
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.20 KB | None | 0 0
  1. #include<stdio.h>
  2. #include<math.h>
  3. int main()
  4. {
  5. float n,x1,x2,x3,x4,dif;
  6. int a1,a2,a3,a4,a5,a6,a7,r1,r2,r3,r4,r5,r6,c1,c2,c3,c4,c5;
  7. scanf("%f",&n);
  8.  
  9. a1=n/100;
  10. r1=(int)n%100;
  11. a2=r1/50;
  12. r2=r1%50;
  13. a3=r2/20;
  14. r3=r2%20;
  15. a4=r3/10;
  16. r4=r3%10;
  17. a5=r4/5;
  18. r5=r4%5;
  19. a6=r5/2;
  20. r6=r5%2;
  21. a7=r6/1;
  22. dif=n-((a1*100)+(a2*50)+(a3*20)+(a4*10)+(a5*5)+(a6*2)+(a7*1));
  23. float r=roundf(dif*100)/100;
  24. c1=r/.5;
  25. x1=r-(c1*.5);
  26. c2=x1/.25;
  27. x2=x1-(c2*.25);
  28. c3=x2/.10;
  29. x3=x2-(c3*.10);
  30. c4=x3/.05;
  31. x4=x3-(c4*.05);
  32. c5=x4/.01;
  33.  
  34.  
  35. printf("NOTAS:\n");
  36. printf("%d nota(s) de R$ 100.00\n",a1);
  37. printf("%d nota(s) de R$ 50.00\n",a2);
  38. printf("%d nota(s) de R$ 20.00\n",a3);
  39. printf("%d nota(s) de R$ 10.00\n",a4);
  40. printf("%d nota(s) de R$ 5.00\n",a5);
  41. printf("%d nota(s) de R$ 2.00\n",a6);
  42. printf("MOEDAS:\n");
  43. printf("%d moeda(s) de R$ 1.00\n",a7);
  44. printf("%d moeda(s) de R$ 0.50\n",c1);
  45. printf("%d moeda(s) de R$ 0.25\n",c2);
  46. printf("%d moeda(s) de R$ 0.10\n",c3);
  47. printf("%d moeda(s) de R$ 0.05\n",c4);
  48. printf("%d moeda(s) de R$ 0.01\n",c5);
  49. return 0;
  50.  
  51. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement