You are on page 1of 2

Khedut shikshan mandal's

R.B.Madkholkar Mahavidyalaya Chandgad


Computer Science
Name:-Mahesh Appaji Rane. Date:-
Class:-B.Sc.II Roll No:-204
Year :-2020-21 PRN NO.:-2019078592

---------------------------------------------------------------------------------------------------------------------------
Assignment no: 10
Assignment Name: Write a php script to find leap year or not.
---------------------------------------------------------------------------------------------------------------------------
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width initial-scale=1"/>
</head>
<body align=center>
<h2> The Leap year</h2><br><hr><br>
<form action="leap_year.php" method="post">
<input type="text" name="year" /><br><br>
<input type="submit" />
</form><br><hr><br>
<font color="black">
<?php

if( $_POST )
{
//get the year
$year = $_POST[ 'year' ];

//check if entered value is a number


if(!is_numeric($year))
{
echo "Strings not allowed, Input should be a number";
return;
}

//multiple conditions to check the leap year


if( (0 == $year % 4) and (0 != $year % 100) or (0 == $year % 400) )
{
echo "$year is a leap year";
}
else
{

Page no:-21
echo "$year is not a leap year";
}

?>
</font>
</body>
</html>

Page no:-21

You might also like