How To Implement PHP Program To Find Even Or Odd Number

admin_img Posted By Bajarangi soft , Posted On 27-11-2020

We have Even numbers which are divisible by 2. Numbers like 2,4,6,8,10, etc are even and Odd numbers which are not divisible by 2. Numbers Like 1, 3, 5, 7, 9, 11, etc are odd.So today we check number even or odd numbers by implementing code in php

How To Implement PHP Program To Find Even Or Odd Number

Complete Code For Implementing PHP Program To Find Even Or Odd Number.

<!DOCTYPE html>
<html>
<head>
    <title>How To Implement PHP Program To Find Even Or Odd Number</title>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.0/css/bootstrap.min.css" rel="stylesheet">
</head>
<style>
    body {
        background: black;
    }

    .form-control {
        width: 80%;
    !important;
    }
</style>
<body>
<body>
<div class="container">
    <br/><br/>
    <div class="text-center">
        <h1 id="color" style="color: white;">Even or Odd Number</h1>
    </div>

    <div class="well">
        <form name="num"  action="#" method="POST">
            <input class="form-control" type="text" name="num" />
        </form>
        <?php
        if(isset($_POST['num']))
        {
            $num = $_POST['num'];
            if($num%2==0)
            {
                echo "$num is Even Number";
            }
            else
            {
                echo "$num is Odd Number";
            }
        }
        ?>
    </div>
</div>
</body>
</html>

Related Post