Leap Year
PHP
Easy
5 views
Problem Description
Print YES if the year is a leap year, otherwise NO.
Input Format
One integer year.
Official Solution
<?php
$inputText=trim(stream_get_contents(STDIN));
if($inputText==='') exit;
$y=intval($inputText);
$leap=($y%400===0) || (($y%4===0) && ($y%100!==0));
echo $leap ? 'YES' : 'NO';
?>
Solutions (0)
No solutions submitted yet. Be the first!
No comments yet. Start the discussion!