Thursday, March 31, 2022

Python (conditional Statement)

 If Conditional Statement

1. if 

2. if .. Else

3. nested

Program:1 IF

    Num = Int(input("Please enter any no"))

    If num%2 = = 0 :

            print ("Number is even ")


Program 2 if ... else

    Num = Int(input("Please enter any no"))

    If num%2 = = 0 :

            print ("Number is even ")

    Else :

            Print (" no is odd")


Program 3

    Num = Int(input("enter any No."))

    if  Num = = 10 :

        Print ("num is    Equal to 10 ")

    elif Num = = 50:

        Print ("No is equal to 10 ")

    Else:

        Print (" no. is not equal to 10 and 50 )



Refrence

No comments:

Post a Comment