const isLeapYarrr = year => (year % 100 === 0) ? (year % 400 === 0) : (year % 4 === 0);
y = int(input())
if (y % 400 == 0) or (y % 100 != 0 and y %4 == 0):
print(y,"is leap year.")
else:
print(y,"isn't leap year.")
public static void main(String[] args) {
int year = 2005;
if ((year % 400 == 0) || ((year % 4 == 0) && (year % 100 != 0))){
System.out.println(year+" leap year");
}else {
System.out.println(year+" not a leap year");
}
}
// works in C, C++, C#, Java, JavaScript, and other C-like languages
// optimal technique
if (((year & 3) == 0 && ((year % 25) != 0) || (year & 15) == 0)) {
// leap year
}
// classic technique
if (year % 4 == 0 && (year % 100 != 0 || year % 400 == 0)) {
// leap year
}
#include<iostream>
using namespace std;
int main() {
int year = 2016;
if (((year % 4 == 0) && (year % 100 != 0)) || (year % 400 == 0))
cout<<year<<" is a leap year";
else
cout<<year<<" is not a leap year";
return 0;
}
leapYear = int(input("Input a Year "))
if leapYear %4 == 0:
print("Its a leap year")
else:
print ("Its a normal year")
<?php
$year = 2022;
if($year % 4 == 0) {
echo $year." is a leap year";
}
else {
echo $year." is a not leap year";
}
?>
def is_leap_year(year):
"""This functon returns True if year is a leap year, returns False otherwise"""
if year % 4 == 0:
return True
return False