php program to check whether a number is positive or negative

Check whether a number 

php program to check whether a number is positive or negative

Q. program to check whether a number is positive or negative or Zero 

Example ::-

<?php

$no=49;
$result=($no>0)? "positive no":"Negative no" ;
echo $result;

?>

 output ::-

positive no 


Q. php program to check whether a number is positive or negative or Zero 

Form.  

Example

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="
width=device-width, initial-scale=1.0">
    <link rel ="stylesheet" href="
css/bootstrap.css">
    <title>Document</title>
</head>
<body class="bg-primary">
<div class="bg-white col-md-4 mx-auto mt-5 p-3">
<h5>positive/negative /zero</h5>
    <form action="accept-posi-nega-no.php"
method="get">
    <label>enter any no</label>    
    <input type="number" name="no" class="
form-control" required>
    <input type="submit" value="check" name="b1"
class="btn-btn-primary mt-2">

    </form>
    <?php
        if(isset($_GET['b1']))
        {
            $number=$_GET['no'];
       
        if($number>0)
        {
            echo"positive no";
        }
        else if ($number<0)
        {
            echo"negative";
        }
        else
        {
            echo "no is zero";
        }
    }


       
    ?>
    </div>
</body>
</html>


 php program to check whether a number is positive or negative or Zero 

Form . 

Output :--


Related post ::::-

javascript do while loop

php course online

forgot password form


Comments

Popular posts from this blog

HTML Tag

CSS Text Color Explained with Syntax and HTML Examples

html script tag attributes

CSS text-emphasis-color Property

HTML Input Type Submit Syntax and Example

CSS Padding Property Explained

How to Display T Pattern in C with Star (*) – Step-by-Step