1
2
3
4
5
6
7
8
9
10
|
def tinh_lai_kep(goc_tien, lai_suat, so_nam): # Tính lãi kép
tong_so_tien [j88 casino](/hy/fa88f28c.html) = [j8bet com](/hy/6cb5ad08.html) goc_tien * (1 + lai_suat / 100) ** so_nam # Giữ hai chữ số thập phân
return round(tong_so_tien, 2)
# Cách dùng ví dụ
goc_tien [j88 tặng 50k](/hy/4b4dd526.html) = float(input("Vui lòng nhập gốc tiền: "))
lai_suat = float(input("Vui lòng nhập lãi suất: "))
so_nam = int(input("Vui lòng nhập số năm: "))
lai_kep = tinh_lai_kep(goc_tien, lai_suat, so_nam)
print(f"Tổng số tiền gốc và lãi là: {lai_kep}")
|