Array ( [0] => [1] => questions [2] => Basic [3] => Leap-Year ) Basic | Leap Year | THE INQUISITIVE





Leap Year

LEVEL:Beginner

Description

Given a Number N. You have to find the given number is a leap year or not.

Input Format

First line contains one integers.

Output Format

Print Yes if it is leap year else No.


Example 1:

Input
2024
Output
Yes
Example 2:

Input
2000
Output
Yes
Example 3:

Input
2101
Output
No

oops

Login to see Discussion




Approach


Step-i) if remainder of the division of given year by 4 is 0 go to next step else return "No"

Step-ii) if remainder of the division of given year by 100 is 0 go to next step else return "Yes"

Step-iii) if remainder of the division of given year by 400 is 0 return "Yes" else return "No"

Time Complexity: O(1)
Space Complexity: O(1)


Note :

Let us know if you can come up with a better approach, mail us at support@theinquisitive.in Your approach will be reviewed and posted with credits to you.

oops

Login to see Solution