-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCoinCounter.py
More file actions
75 lines (57 loc) · 1.39 KB
/
CoinCounter.py
File metadata and controls
75 lines (57 loc) · 1.39 KB
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
66
67
68
69
70
71
72
73
74
75
# Python program to divide coins
# Declare coin number variables
numCoins = 0
oneCoin = 0
twoCoin = 0
fiveCoin = 0
tenCoin = 0
twentyfiveCoin = 0
fiftyCoin = 0
hundredCoin = 0
# Get coin value from user
coinValue = int(input("Enter the coin value: "))
# Count hundred coins
hundredCoin = int(coinValue / 100)
numCoins += hundredCoin
coinValue %= 100
# Count fifty coins
fiftyCoin = int(coinValue / 50)
numCoins += fiftyCoin
coinValue %= 50
# Count twenty-five coins
twentyfiveCoin = int(coinValue / 25)
numCoins += twentyfiveCoin
coinValue %= 25
# Count ten coins
tenCoin = int(coinValue / 10)
numCoins += tenCoin
coinValue %= 10
# Count five coins
fiveCoin = int(coinValue / 5)
numCoins += fiveCoin
coinValue %= 5
# Count two coins
twoCoin = int(coinValue / 2)
numCoins += twoCoin
coinValue %= 2
# Count one coins
oneCoin += coinValue
numCoins += oneCoin
# Output coin values
print("\nCoin Values\n")
# Print one coins
print("One Coins: ",oneCoin)
# Print two coins
print("Two Coins: ",twoCoin)
# Print five coins
print("Five Coins: ",fiveCoin)
# Print ten coins
print("Ten Coins: ",tenCoin)
# Print twenty-five coins
print("Twenty-Five Coins: ",twentyfiveCoin)
# Print fifty coins
print("Fifty Coins: ",fiftyCoin)
# Print hundred coins
print("Hundred Coins: ",hundredCoin,"\n")
# Print total coins
print("Total Coins: ",numCoins)