Friday, 31 January 2020

11th C class menu driven program for reference

def prog5_fac():
    print("1st program")
   
def prog15_fib():
    print("2nd program")
   
def prog3_sum():
    print("3rd program")

#main program
ch='y'
while ch == 'y' :
    print("1 for 1st prog, 2 for 2nd prog,3 for 3rd prog and 4 for exit ")
   

    c=int(input("Enter the choice: "))
    if c==1:
        prog5_fac()
    elif c==2:
        prog15_fib()
    elif c==3:
        prog3_sum()
    elif c==4:
        print("Thankyou for using python ")
        break
    print("you want to continue y/n")
    ch=str(input("enter choice y/n"))


output
1 for 1st prog, 2 for 2nd prog,3 for 3rd prog and 4 for exit
Enter the choice: 1
1st program
you want to continue y/n
enter choice y/ny
1 for 1st prog, 2 for 2nd prog,3 for 3rd prog and 4 for exit
Enter the choice: 3
3rd program
you want to continue y/n
enter choice y/ny
1 for 1st prog, 2 for 2nd prog,3 for 3rd prog and 4 for exit
Enter the choice: 2
2nd program
you want to continue y/n
enter choice y/n 4
>>> 

No comments:

Post a Comment