Simple interest is calculated using the formula: Simple Interest = (Principal Amount * Rate of Interest * Time Period) / 100.
def calculate_simple_interest(principal, rate, time):
return (principal * rate * time) / 100
# Taking input from the user for principal amount, rate of interest, and time period
principal = float(input("Enter the principal amount: "))
rate = float(input("Enter the rate of interest (in percentage): "))
time = float(input("Enter the time period (in years): "))
interest = calculate_simple_interest(principal, rate, time)
print("Simple Interest:", interest)
Enter the principal amount: 5000
Enter the rate of interest (in percentage): 7.5
Enter the time period (in years): 2
Simple Interest: 750.0
Enter the principal amount: 10000
Enter the rate of interest (in percentage): 5
Enter the time period (in years): 3.5
Simple Interest: 1750.0
The function calculate_simple_interest(principal, rate, time)
takes the principal amount, rate of interest, and time period as input and returns the simple interest using the formula provided.
The example usage section demonstrates how to take input from the user for these parameters, calculate the simple interest, and print the result.