Dcoder icon

Leap Year @ Dcoder

By Lochard | As a newbie programmer | 11 Mar 2023


roblem: Steve is playing a quiz game with his brother John. As Steve just learned the concept of leap year, John wanted to test his knowledge. For that, John started to ask Steve whether a year is a leap year or not by giving him a random year. Steve is little confused and he asks your help to the quiz.

 

Input: The first line of input contains one integer T.

 Next T lines will have years given by John.

Output: For each test case print "Yes" if it is a leap year else "No".

Constraints: 1<=T<=100.

10^3<=Year<=10^5.

Sample Input: 2

2000

2017

Sample Output: 

Yes

No

for i in range(int(input())):
  year = int(input())
  print('Yes' if year % 400 == 0 or year % 100 and year % 4 == 0 else 'No')

How do you rate this article?

0


Lochard
Lochard

20240228 Arrived in the UK for about 2 week. All my fears persist. Some are even getting worse. https://github.com/locharp/asylum_diary/


As a newbie programmer
As a newbie programmer

Sharing entry level codes. My snippets on GitHub https://github.com/locharp/code-snippets

Send a $0.01 microtip in crypto to the author, and earn yourself as you read!

20% to author / 80% to me.
We pay the tips from our rewards pool.