Programming Pandit

c/c++/c#/Javav/Python


Latest Update

Monday, February 6, 2023

Write a Program to check and print whether a given number is even or odd.

 

<html> 

<body>

<form method="post">

 Enter a number:

<input type="number" name="number">

<input type="submit" value="Submit">

</form>

</body>

</html> 


<? php 

if($_POST)

{

$number = $_POST['number'];


//divide entered number by 2

//if the reminder is 0 then the number is even otherwise the 


number is odd if(($number % 2) == 0)

echo "$number is an Even number";

}

else

{

 echo "$number is Odd number";

}

}

?>








 

No comments:

Post a Comment