Program using Conditional Statements

Q1. Program to find Greatest between two Numbers

a = int(input(“Enter 1st Number”))
b = (int(input(‘Enter 2nd Number’)))
if a>b :
        print (“%d is greater than %d ” % (a,b))
else :
        print (“%d is greater than %d ” % (b,a))

Q2. Program to check whether the given Year is  Leap Year.

year=int(input(“Enter Year”))
if year%100 ==0 and year % 4==0 :
        print(“%d year is leap Year” %(year))
else :
         print(“%d year is not a leap Year” %(year))

Q3. Program to Calculate Grade 

s1 = int(input(“ENter Marks of 1st Subject”))
s2 = (int(input(‘ENter Marks of 2nd Subject’)))
s3 = (int(input(‘ENter Marks of 3rd Subject’)))
s4 = (int(input(‘ENter Marks of 4th Subject’)))
s5 = (int(input(‘ENter Marks of 5th Subject’)))
total =s1 +s2 +s3 +s4 +s5
per =total/5
print (“\n\n Grade = “,end=”)
if per>=90 :
      print(“A”)
elif per> 60 :
    print (“B”)
elif per> 45 :
    print (“C”)
elif per> 33 :
    print (“D”)
else :
    print (“E”)

Q4. Program to find greatest among Three Numbers

a = int(input(“ENter 1st Number”))
b = (int(input(‘ENter 2nd Number’)))
c = int(input(“ENter 3rd Number”))
if a>b :
       if a>c:
            print (“%d is greatest ” % (a))
       else :
            print (“%d is greatest” % (c))

else :
       if b>c :
             print (“%d is greatest” % (b))
      else :
              print (“%d is greatest” % (c))

Q5. Program to check whether the no. is Even or Odd.

a=int(input(‘Enter a Number’)

if (a%2==0):

    print(a, “is an Even Number”)

else: 

     print(a, “is an Odd Number”)