very basic code which we use offten in our day to day development and sometime we stucked . i write those issue here with simple solution. You will get codes of html, css, javascript, jquery, json,ajax, node.js, vue.js, nuxt.js, php and Mysql
Thursday, November 16, 2017
Friday, November 10, 2017
How to get a given year is a leap year using PHP or Excel/Spreadsheet
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
Subscribe to:
Posts (Atom)