Skip to main content

//Arthmatic Operator

Arthmatic Operator


  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <title></title>
  6. </head>
  7. <body>
  8. <script type="text/javascript">
  9. var a= 21; //Variable def
  10. var b= 10;
  11. var c;

  12. //Addition
  13. c = a + b;
  14. document.write("the addition is :"+c+"<br>"); // document.write() use for print line.

  15. //Subtraction
  16. c = a - b;
  17. document.write("the subtraction is :"+c+"<br>"); // +c+ is used to indicate which value should be print.

  18. //Multiplication
  19. c = a * b;
  20. document.write("the multipliation is :"+c+"<br>");// <br> use for linebreake

  21. //Division
  22. c = a / b;
  23. document.write("the divition is :"+c+"<br>");

  24. //Modulus
  25. c = a % b;
  26. document.write("the modulus is :"+c+"<br>");
  27. </script>
  28. </body>
  29. </html>

//Execute


//Output 

/*

the addition is :31

the subtraction is :11

the multipliation is :210

the divition is :2.1

the modulus is :1

*/


                              

                                     //ThE ProFessor