AnkitWebLogic

PHP - Arithmetic operator

Q1. Write a program in PHP to calculate addition, subtraction, multiplication, division, modulas, power using operator. 1

<?php
    $a=10;
    $b=20;
    $c=$a+$b;
    echo "Sum of $a and $b is ".$c;
    
    $d=$a-$b;
    echo "<br>Subtraction of $a and $b is ".$d;
    
    $e=$a*$b;
    echo "<br>Multiplication of $a and $b is ".$e;
    
    $f=$a/$b;
    echo "<br>Division of $a and $b is ".$f;
    
    $g=$a%$b;
    echo "<br>Modulas of $a and $b is ".$g;
    
    $h=$a**2;
    echo "<br>$a Power 2 is ".$h;
?>
Sum of 10 and 20 is 30
Subtraction of 10 and 20 is -10
Multiplication of 10 and 20 is 200
Division of 10 and 20 is 0.5
Modulas of 10 and 20 is 10
10 Power 2 is 100