Year 1600 was leap year but not 1700.
How to solve this output using php (solution for excel/Spreadsheet is in bottom of the page).
Here is the code.
<?php
$year = 2020;
$dBy4 = gmp_div_r($year, 4);
$answer = 'Not a Leap year';
if($dBy4 == 0) {
$dBy100 = gmp_div_r($year, 100);
$dBy400 = gmp_div_r($year, 400);
if($dBy100 == 0 && $dBy400 == 0) {
$answer = $year.' is a leap year';
}
}
// $dBy4 = gmp_div_r($year, 4);
echo $answer;
?>
Try out this Fiddle
Also here is the solution for EXCEL
Download excel/ spreadsheet
How to solve this output using php (solution for excel/Spreadsheet is in bottom of the page).
Here is the code.
<?php
$year = 2020;
$dBy4 = gmp_div_r($year, 4);
$answer = 'Not a Leap year';
if($dBy4 == 0) {
$dBy100 = gmp_div_r($year, 100);
$dBy400 = gmp_div_r($year, 400);
if($dBy100 == 0 && $dBy400 == 0) {
$answer = $year.' is a leap year';
}
}
// $dBy4 = gmp_div_r($year, 4);
echo $answer;
?>
Try out this Fiddle
Also here is the solution for EXCEL
Download excel/ spreadsheet
No comments:
Post a Comment