Write a program which prompts the user to input principal, rate and time and calculate compound interest. The formula is : CI = P(1+R/100)^T - P.

Source Code

principal = float(input("Enter the principal amount: "))
rate = float(input("Enter the rate of interest: "))
time = float(input("Enter the time in years: "))
compound_interest = principal * ((1 + rate/100) ** time) - principal
print("The compound interest is:", compound_interest)

Output

Enter the principle amount: 1000
Enter the interest rate: 5
Enter the time period in years: 2
The compound interest is: 105.1