Monday, July 27, 2020

Write a Program to Check Leap Year in Python.

Check Leap Year in Python.

year = int(input("Enter a year :: "))  
if (year % 4) == 0:  
   if (year % 100) == 0:  
       if (year % 400) == 0:  
           print("{0} is a leap Year  ".format(year))  
       else:  
           print("{0} is not a leap Year  ".format(year))  
   else:  
       print("{0} is a leap Year  ".format(year))  
else:  
   print("{0} is not a leap Year  ".format(year))  


OUTPUT

Enter a year :: 1996
1996 is a leap Year 



No comments:

Post a Comment

Please do not any spam link in Comment Box