# Program to calculate compound interest

# Calculate the compound interest for principal using formula: A = P (1 + r/n)**(nt)
# r = annual interest rate
# n = number of compounds per period (usually in months)
# t = time

principalinput = input("Enter principal: ")
annualrateinput = input("Enter annual rate: ")
numberoftimescompoundedinput = input("Enter number of times that the interest is compounded per year: ")
yearsinput = input("Time in years: ")

# Convert entered input from strings into integers
principal = int(principalinput)
annualrate = (int(annualrateinput))/100
numberoftimescompounded = int(numberoftimescompoundedinput)
years = int(yearsinput)

print ("The principal entered is: ", principal)
print ("The annual rate in decimal form is: ", annualrate)
print ("The number of times it will be compounded per year is: ", numberoftimescompounded)
print ("The number of years it will be compounded: ", years)

# calculate compound interest plus the principal
preliminarynumber = (1 + (annualrate/numberoftimescompounded))
# print ("Preliminary number:", preliminarynumber)
raisedtopower = (numberoftimescompounded * years)
# print ("Raised to power:", raisedtopower)

compoundinterestplusprincipal = principal * (preliminarynumber**raisedtopower)

print("The compound interest plus the principal is: ", compoundinterestplusprincipal)

print ("Total Amount:", compoundinterestplusprincipal)
