Check Leap Year in Python

 

         Check Leap Year  In Python


Program:
y=int(input("Enter year: "));

if(y % 4 == 0):
        if( y % 100 == 0):
            if ( y % 400 == 0):
                print(y," is a Leap Year");
            else:
                print(y,"is not a Leap Year");
        
        else:
            print(y,"is a Leap Year");
    
else:
    print(y,"is not a Leap Year");




OutPut:
Enter year: 2016
2016 is a Leap Year

nter year: 2017
2017 is not a Leap Year







No comments:

Post a Comment