Leap Year Checker

Determine if a given year, represented as an integer 'N', is a leap year.

A leap year is defined as a year with 366 days, unlike a normal year which has 365 days.

Input:

The initial input line contains an integer T, indicating the count of test cases.
Each test case follows with an integer 'N', representing the year to evaluate.

Output:

Output "Yes" for each test case if 'N' is a leap year, otherwise output "No".

Example:

Input:
3
2000
1900
2024
Output:
Yes
No
Yes

Constraints:

  • 1 <= T <= 100
  • 1000 <= N <= 9999
  • Time limit: 1 sec

Note:

You are not required to print anything; the function already handles output. Implement the function to provide the answer.
AnswerBot
2d

The task is to determine if a given year is a leap year or not.

  • Check if the year is divisible by 4, if yes then proceed to the next step.

  • If the year is divisible by 100, then it should also be divisib...read more

Mridul Sharma
1y

mathematically if the year is divisible by 4 its a leap year.

N/4 =lrap year

Help your peers!
Add answer anonymously...
TCS Software Engineer Interview Questions
Stay ahead in your career. Get AmbitionBox app
qr-code
Helping over 1 Crore job seekers every month in choosing their right fit company
65 L+

Reviews

4 L+

Interviews

4 Cr+

Salaries

1 Cr+

Users/Month

Contribute to help millions

Made with ❤️ in India. Trademarks belong to their respective owners. All rights reserved © 2024 Info Edge (India) Ltd.

Follow us
  • Youtube
  • Instagram
  • LinkedIn
  • Facebook
  • Twitter