Skip to main content

//Arthmatic Operator

Arthmatic Operator


  1. <?php
  2. //Arthmatic Operator

  3. $a = 21; // $ use for variables   
  4. $b = 10;

  5. //Addition
  6. $c = $a + $b;
  7. echo ("the value of c is :".$c."<br>"); // echo use for print line.

  8. //Subtraction
  9. $c = $a - $b;
  10. echo ("the value of c is :" .$c."<br>"); // .$c. is used to indicate which value should be print.

  11. //Multiplication
  12. $c = $a * $b;
  13. echo ("the value of c is :" .$c."<br>"); // <br> use for linebreake

  14. //Division
  15. $c = $a / $b;
  16. echo ("the value of c is :". $c."<br>");

  17. //Modulus
  18. $c = $a % $b;
  19. echo ("the value of c is :" .$c."<br>");
  20. ?>  

//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