+ 13
[Challenge] Check if the year is leap or non-leap year?
Check if any year is leap "366 days" or non-leap "365 days" year? All languages are welcomed!
21 Antworten
+ 5
My answer in Java is here
https://code.sololearn.com/cpDXlu69mcVn/?ref=app
+ 27
https://code.sololearn.com/c7VMXRWuJ4l7/?ref=app
+ 15
//looks like it will be used again for some challenges which will be asked again 😂
https://code.sololearn.com/c9xVV0L6XY4q/?ref=app
+ 11
Display leap years
https://code.sololearn.com/cR9ZEk5uq8or/?ref=app
+ 10
https://code.sololearn.com/cjkCorfgZ46q/?ref=app
+ 7
https://code.sololearn.com/W4lJar4bORpL/?ref=app
+ 7
https://code.sololearn.com/cL84II6vBrhk/?ref=app
as simple as that!!!
+ 5
A simple code in C..
https://code.sololearn.com/cKJHBk7CeadB/#c
+ 4
Also every 400 years a leap year cancels!
+ 3
Here's mine
https://code.sololearn.com/ceZIIX6hdSjv/?ref=app
+ 3
https://code.sololearn.com/ccYFn5chrUTu/?ref=app
+ 2
Ruby:
2 ways: easy and even more easy
https://code.sololearn.com/cneRcgB04IRZ
+ 2
https://code.sololearn.com/cctWpXxFmA66/#c
+ 1
My Answer In python
'''y means year'''
y=int(input("Enter a Year"))
if(y%4)==0:
if(y%100)==0:
if(y%400)==0:
print("{0} is a leap year-366Days".format(y))
else:
print("{0} is not a leap year-365Days".format(y))
else:
print("{0} is a leap year-365days".format(y))
else:
print("{0} is not a leap year-366days".format(y))
+ 1
Kinda ugly Python two-liner:
https://code.sololearn.com/c6ljT9xFyx4X/?ref=app