Guest User

Untitled

a guest
Jul 16th, 2018
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.83 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. int main()
  4. {
  5. int a,b,v;
  6. //a= 4990;
  7. //b= 5010;
  8. printf("Inserte precio y dinero entregado\n");
  9. scanf("%d %d",&a,&b);
  10.  
  11.  
  12. v= (b-a);
  13. int m10,m50,m100,m500,m1000,m5000,m10000;
  14.  
  15. m10000=0;
  16. m5000=0;
  17. m1000=0;
  18. m500=0;
  19. m100=0;
  20. m50=0;
  21. m10=0;
  22.  
  23.  
  24.  
  25. if ((v/10000)>=1)
  26. {
  27. m10000=(v/10000);
  28. v=v-(v/10000)*10000;
  29. }
  30. if ((v/5000)>=1)
  31. {
  32. m5000=(v/5000);
  33. v=v-((v/5000)*5000);
  34. }
  35. if ((v/1000)>=1)
  36. {
  37. m1000=(v/1000);
  38. v=v-((v/1000)*1000);
  39. }
  40. if ((v/500)>=1)
  41. {
  42. m500=(v/500);
  43. v=v-((v/500)*500);
  44. }
  45. if ((v/100)>=1)
  46. {
  47. m100=(v/100);
  48. v=v-((v/100)*100);
  49. }
  50. if ((v/50)>=1)
  51. {
  52. m50=(v/50);
  53. v=v-((v/50)*50);
  54. }
  55. if ((v/10)>=1)
  56. {
  57. m10=(v/10);
  58. v=v-((v/10)*10);
  59. }
  60.  
  61.  
  62. printf ("Se debe entregar %d b10000, %d b5000, %d b1000, %d m500, %d m100, %d m50, %d m10, %d m1",m10000,m5000,m1000,m500,m100,m50,m10,v);
  63.  
  64. return 0;
  65. }
Add Comment
Please, Sign In to add comment