Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Checkes if a given year is leap year or not #29

Merged
merged 1 commit into from
Oct 9, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions Programs/LeapYear.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Checkes if a given year is leap year or not

# To determine whether a year is a leap year, follow these steps:
# Step 1: If the year is evenly divisible by 4, go to step 2. Otherwise, go to step 5
# Step 2: If the year is evenly divisible by 100, go to step 3. Otherwise, go to step 4
# Step 3: If the year is evenly divisible by 400, go to step 4. Otherwise, go to step 5
# Step 4: The year is a leap year (it has 366 days)
# Step 5: The year is not a leap year (it has 365 days)

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))