-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathkasir.py
More file actions
executable file
·44 lines (30 loc) · 1.06 KB
/
kasir.py
File metadata and controls
executable file
·44 lines (30 loc) · 1.06 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
"""
kasir.py
The user enters a cost and then the amount of money given. The program will figure out the change and the number of quarters, dimes, nickels, pennies needed for the change.
"""
from math import floor
uang = int(input("Masukkan uang (Rp): "))
harga = int(input("Masukkan harga barang (Rp): "))
if (uang < harga):
print("Uang kurang")
else:
kembalian = uang - harga
print("Kembalian: " + str(kembalian))
sisa = kembalian
print(str(floor(sisa / 100000)) + " x Rp100000")
sisa = sisa % 100000
print(str(floor(sisa / 50000)) + " x Rp50000")
sisa = sisa % 50000
print(str(floor(sisa / 20000)) + " x Rp20000")
sisa = sisa % 20000
print(str(floor(sisa / 10000)) + " x Rp10000")
sisa = sisa % 10000
print(str(floor(sisa / 5000)) + " x Rp5000")
sisa = sisa % 5000
print(str(floor(sisa / 2000)) + " x Rp2000")
sisa = sisa % 2000
print(str(floor(sisa / 1000)) + " x Rp1000")
sisa = sisa % 1000
print(str(floor(sisa / 500)) + " x Rp500")
sisa = sisa % 500
print("Sisa: Rp" + str(sisa))