SHARE
TWEET

Coin and note count

efat1531 Jan 25th, 2020 79 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include<stdio.h>
  2. void main()
  3. {
  4.     double note[]={100,50,20,10,5,2};
  5.     double coin[]={1.00,0.50,0.25,0.10,0.05,0.01};
  6.     double amount;
  7.     int t,i;
  8.     scanf("%lf",&amount);
  9.     printf("NOTAS:\n");
  10.     for(i=0;i<6;i++)
  11.     {
  12.         t=amount/note[i];
  13.        amount-=(note[i]*t);
  14.         printf("%d nota(s) de R$ %.2lf\n",t,note[i]);
  15.     }
  16.     printf("MOEDAS:\n");
  17.     for(i=0;i<6;i++)
  18.     {
  19.         t=amount/coin[i];
  20.        amount-=(coin[i]*t);
  21.         printf("%d moeda(s) de R$ %.2lf\n",t,coin[i]);
  22.     }
  23.     return 0;
  24. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top