Arthmatic Operator
- <?php
- //Arthmatic Operator
- $a = 21; // $ use for variables
- $b = 10;
- //Addition
- $c = $a + $b;
- echo ("the value of c is :".$c."<br>"); // echo use for print line.
- //Subtraction
- $c = $a - $b;
- echo ("the value of c is :" .$c."<br>"); // .$c. is used to indicate which value should be print.
- //Multiplication
- $c = $a * $b;
- echo ("the value of c is :" .$c."<br>"); // <br> use for linebreake
- //Division
- $c = $a / $b;
- echo ("the value of c is :". $c."<br>");
- //Modulus
- $c = $a % $b;
- echo ("the value of c is :" .$c."<br>");
- ?>
//Execute
/* Output
the value of c is :31
the value of c is :11
the value of c is :210
the value of c is :2.1
the value of c is :1
*/
//ThE ProFessoR