PHP Program To Demonstrate Arithmetic Operators

Write PHP Code to Demonstrate Arithmetic Operators

<!--Write A Programme To Implement Arithmetic Operator in PHP -->

<html>
    <bod>
        <?php
        
            $a = 29; 
            $b = 4; 

            echo "Addition : ".$a." + ".$b. " = ". ($a + $b);
            echo "<br>Subtraction : ".$a." - ".$b. " = ". ($a - $b);
            echo "<br>Multiplicaton : ".$a." * ".$b. " = ". ($a * $b);
            echo "<br>Division : ".$a." / ".$b. " = ". ($a / $b);
            echo "<br>Remainder : ".$a." % ".$b. " = ". ($a % $b);
            echo "<br>Exponent : ".$a." ^ ".$b. " = ". pow($a, $b);

        ?>
    </bod>
</html>

Output:

Addition : 29 + 4 = 33
Subtraction : 29 - 4 = 25
Multiplicaton : 29 * 4 = 116
Division : 29 / 4 = 7.25
Remainder : 29 % 4 = 1
Exponent : 29 ^ 4 = 707281

≪ Previous | Next ≫