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.")
// 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
}
$day = [ 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 ];
$year = 2021;
if (($year % 4 == 0 && $year % 100 != 0) || ($year % 400 == 0)) {
$day = [ 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 ];
echo "This is leap year - get 366 day";
} else {
echo "This is NOT leap year - get ONLY 365 day";
}
#include <stdio.h>
int main() {
int year;
year = 2016;
if (((year % 4 == 0) && (year % 100!= 0)) || (year%400 == 0))
printf("%d is a leap year", year);
else
printf("%d is not a leap year", year);
return 0;
}