Answers for "check if the year is a leap year or not in ptyhon"

2

getting leap year in python

year = int(input("Write any year to check if it is leap year:- "))
if year % 4 == 0:
  if year % 100 == 0:
    if year % 400 == 0:
      print("Leap year.")
    else:
      print("Not leap year.")
  else:
    print("Leap year.")
else:
  print("Not leap year.")
Posted by: Guest on June-30-2021
0

Check if a year is a leap year

if (((year % 4 == 0) && (year % 100 != 0)) || (year % 400 == 0))
cout<<year<<" is a leap year";
else
cout<<year<<" is not a leap year";
Posted by: Guest on August-21-2021

Code answers related to "check if the year is a leap year or not in ptyhon"

Python Answers by Framework

Browse Popular Code Answers by Language