PHP Compiler
<!DOCTYPE html> <html> <body> <?php $start = 2000; $end = 2030; $flag = 0; echo "Leap year(s) between $start and $end: <br>"; for($start=$start; $start<=$end; $start++) { if($start % 4 == 0) { if(($start % 100 == 0) && ($start % 400 != 0)) { // Not a leap year } else { $flag = 1; echo "$start "; } } } if($flag == 0) echo "There is no leap year between between the given range"; ?> </body> </html>
OUTPUT
Leap years between 2000 and 2030:
2000 2004 2008 2012 2016 2020 2024 2028
×

Save as Private