Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int main()
- {
- int a,b,v;
- //a= 4990;
- //b= 5010;
- printf("Inserte precio y dinero entregado\n");
- scanf("%d %d",&a,&b);
- v= (b-a);
- int m10,m50,m100,m500,m1000,m5000,m10000;
- m10000=0;
- m5000=0;
- m1000=0;
- m500=0;
- m100=0;
- m50=0;
- m10=0;
- if ((v/10000)>=1)
- {
- m10000=(v/10000);
- v=v-(v/10000)*10000;
- }
- if ((v/5000)>=1)
- {
- m5000=(v/5000);
- v=v-((v/5000)*5000);
- }
- if ((v/1000)>=1)
- {
- m1000=(v/1000);
- v=v-((v/1000)*1000);
- }
- if ((v/500)>=1)
- {
- m500=(v/500);
- v=v-((v/500)*500);
- }
- if ((v/100)>=1)
- {
- m100=(v/100);
- v=v-((v/100)*100);
- }
- if ((v/50)>=1)
- {
- m50=(v/50);
- v=v-((v/50)*50);
- }
- if ((v/10)>=1)
- {
- m10=(v/10);
- v=v-((v/10)*10);
- }
- 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);
- return 0;
- }
Add Comment
Please, Sign In to add comment