Friday, 20 September 2019

Write a program to calculate Simple interest and Compound interest using Loop conditioning

def SI(x):
    print("SI")
    for i in range(1,x+1):
        P=int(input("ENTER P VALUE "))
        R=int(input("ENTER R VALUE "))
        T=int(input("ENTER T "))
        Si=(P*R*T)/100
        print("SI = ",Si)

def CI(x):
    print("CI")
    for i in range (1,x+1):
        P=int(input("ENTER P VALUE "))
        R=int(input("ENTER R VALUE "))
        n=int(input("ENTER n "))
        Ci=P*(1+(R/100))**n
        print("CI",Ci)
#MAIN PROGRAM
x=int(input("ENTER X VALUE ="))
print(x)
ch=int(input("ENTER A CHOICE"))
if ch==1:
    SI(x) #calling function simple interest
elif ch==2:
    CI(x) #calling function compound interest

No comments:

Post a Comment