def s_i(p,r,t): #called function
S_I=(p*r*t)/100
print("Simple Interest=",S_I)
def c_i(p,r,t): #called function
C_I=p*((1+r/100)**t)
print("Compound interest=",C_I)
#main program
p=float(input("Enter p value"))
r=float(input("Enter r value"))
t=float(input("Enter t value"))
s_i(p,r,t) #calling function
c_i(p,r,t) #calling function
Example:
Enter p value1000 Enter r value2 Enter t value5 Simple Interest= 100.0 Compound interest= 1104.0808032
No comments:
Post a Comment