Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int main () {
- int i,coinlist[100],amount,coin,usecoin[100];
- printf("enter the amount :");
- scanf("%d",&amount);
- printf("enter the number of coin:");
- scanf("%d",&coin);
- printf("enter the coin descending order :");
- for(i=0;i<coin;i++)
- {
- scanf("%d",&coinlist[i]);
- }
- for(i=0;i<coin;i++)
- {
- usecoin[i]=amount/coinlist[i];
- amount=amount%coinlist[i];
- }
- printf("solution : \n");
- for(i=0;i<coin;i++)
- {
- printf("%d %d\n",coinlist[i],usecoin[i]);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement