In this python program, we will learn how to calculate the compound interest. Before we start with the program, first we know the formula for calculating the compound interest.
Compound Interest = Principal Amount * (1 + Rate of Interest/100)No. of Years
Here is the source code of the program to calculate the compound interest.
# Python Program to Calculate the Compound Interest
# Import Module
import math
# To take input from the User
principal_amount = float(input("Enter the Principal Amount: "))
rate_of_int = float(input("Enter the Rate Of Interest: "))
time_period = float(input("Enter Time period in Years: "))
ci_future = principal_amount * (math.pow((1 + rate_of_int / 100), time_period))
compound_int = ci_future - principal_amount
print("Future Compound Interest for Principal Amount {0} = {1}".format(principal_amount, ci_future))
print("Compound Interest for Principal Amount {0} = {1}".format(principal_amount, compound_int))
Enter the Principal Amount: 50000
Enter the Rate Of Interest: 8.25
Enter Time period in Years: 5
Future Compound Interest for Principal Amount 50000.0 = 74320.65516305176
Compound Interest for Principal Amount 50000.0 = 24320.655163051764
Comments