print("Welcome to the Loan Calculator!")
print("Please enter the following information:")
principal = float(input("Loan amount: "))
annual_interest_rate = float(input("Annual interest rate (as a decimal): "))
years = int(input("Loan duration (in years): "))
monthly_payment = calculate_loan_payment(principal, annual_interest_rate, years)
total_payment = monthly_payment * years * 12
print(f"\nMonthly payment: ${monthly_payment:.2f}")
print(f"Total payment: ${total_payment:.2f}")
loan_calculator()
Dastur foydalanuvchi tomonidan kredit miqdori (principal), yillik foiz darajasi
(annual_interest_rate) va kredit muddatini (years) so'rab, kredit to'lovlarini hisoblaydi.
calculate_loan_payment()
funksiyasi, kredit to'lovlarini hisoblash uchun formula ishlatadi va
o'tish darajasini oylik hisobga oladi.
Natijada, oylik to'lovni topish uchun kredit muddatini oyda
ko'paytiradi.
loan_calculator() funksiyasi, dastur boshlanishida foydalanuvchini salomlaydi
va kredit
kalkulyatorini ishlatish uchun kredit miqdori, yillik foiz darajasi va kredit muddatini so'ragan
holda
calculate_loan_payment() funksiyasini chaqiradi.
Dastur natijasida, kiritilgan ma'lumotlar
bo'yicha oylik to'lovni va umumiy to'lov miqdorini chiqaradi.
Dostları ilə paylaş: