Use app×
QUIZARD
QUIZARD
JEE MAIN 2026 Crash Course
NEET 2026 Crash Course
CLASS 12 FOUNDATION COURSE
CLASS 10 FOUNDATION COURSE
CLASS 9 FOUNDATION COURSE
CLASS 8 FOUNDATION COURSE
0 votes
1.0k views
in Computer by (20 points)
edited by

To check whether a year is a leap year or not

Please log in or register to answer this question.

1 Answer

0 votes
by (24.9k points)

For a year to be a leap year, it has to satisfy the following conditions:

  1. The year is a multiple of 400.
  2. The year is a multiple of 4 but not 100.

A century year is a year that is a multiple of 100 and ends with 00. For example, 1500 is a century year. The second condition is used to separate the century years from the leap years. A century year is considered to be a leap year only if it is divisible by 400. For instance, the years 1200, 1600, and 2000 are all century leap years. On the other hand, 1300, 1500, and 1900 are century years which do not qualify as leap year.
 

year = int(input('Enter year: '))

if(year % 400 == 0 or (year % 4 == 0 and year % 100 != 0)):
    print(year,'is a leap year')
else:
    print(year,'is not a leap year')

Welcome to Sarthaks eConnect: A unique platform where students can interact with teachers/experts/students to get solutions to their queries. Students (upto class 10+2) preparing for All Government Exams, CBSE Board Exam, ICSE Board Exam, State Board Exam, JEE (Mains+Advance) and NEET can ask questions from any subject and get quick answers by subject teachers/ experts/mentors/students.

Categories

...