1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65
|
#include <iostream.h>
void main()
{
int twenty,ten,five,one,quarters,dimes,nickels,pennies,twenty1,ten1,five1,one1;
float amount,total,total1,total2,total3,total4,total5,total6,quarters1,dimes1,nickels1;
cout <<"ENTER THE AMOUNT IN $"
<<endl;
cin>>amount;
twenty = amount / 20;
twenty1 = twenty * 20;
total = amount - twenty1;
ten = total / 10;
ten1 = ten * 10;
total1 = total - ten1;
five = total1 / 5;
five1 = five * 5;
total2 = total1 - five1;
one = total2 / 1;
one1 = one * 1;
total3 = total2 - one;
quarters = total3 / 0.25;
quarters1 = quarters * 0.25;
total4 = total3 - quarters1;
dimes = total4 / 0.1;
dimes1 = dimes * 0.1;
total5 = total4- dimes1;
nickels = total5 / 0.05;
nickels1 = nickels * 0.05;
total6 = total5 - nickels1;
pennies = total6 / 0.01;
cout<<endl
<<"$"<<amount<<" would be split into: "<<twenty<<"-$20 bills, "<<ten<<"-$10 dollar bills, "<<five<<"-$5 bills, "<<one<<"-$1 bills, "
<<quarters<<"-quarters, "<<dimes<<"-dimes, "<<nickels<<"-nickels and "<<pennies<<"-pennies."
<<endl;
}
|