Answer:
In Python:
L = int(input("Loan Amount: "))
N = int(input("Months: "))
I = float(input("Annual Interest Rate: "))
monthly_payment = round(L/((1 - (1 + I/12)**(-N))/(I/12)),2)
total_payment = round(N * monthly_payment,2)
f= open("outputfile.txt","a+")
f.write(str(L)+"\t\t"+str(I)+"\t\t"+str(N)+"\t\t"+str(monthly_payment)+"\t\t"+str(total_payment)+"\\")
Step-by-step explanation:
The next three lines get the required inputs
L = int(input("Loan Amount: "))
N = int(input("Months: "))
I = float(input("Annual Interest Rate: "))
Calculate the monthly payment
monthly_payment = round(L/((1 - (1 + I/12)**(-N))/(I/12)),2)
Calculate the total payment
total_payment = round(N * monthly_payment,2)
Open the output file
f= open("outputfile.txt","a+")
Write output to file
f.write(str(L)+"\t\t"+str(I)+"\t\t"+str(N)+"\t\t"+str(monthly_payment)+"\t\t"+str(total_payment)+"\\")