Write a JavaScript to design a simple calculator to perform the following operations: sum, product, difference and quotient.

<!DOCTYPE html>

<html>

<head>

      <title>M2-R5.1 Set 6 Question 1</title>

</head>

<body>

            First Number : <input type=”text” name=”num1″ placeholder=”Enter First Number” id=”n1″><br><br>

            Second Number : <input type=”text” name=”num1″ placeholder=”Enter Second Number” id=”n2″><br><br>

            Total Result : <input type=”text” name=”num1″ placeholder=”output” id=’result’><br><br>

            <input type=”submit” name=”sub” value=”Sum” onclick=”add()”>

            <input type=”submit” name=”sub” value=”Product” onclick=”mul()”>

            <input type=”submit” name=”sub” value=”Subtraction” onclick=”sub()”>

            <input type=”submit” name=”sub” value=”Quotient” onclick=”div()”>        

<script type=”text/javascript”>

      function add(){

            var num1=document.getElementById(“n1”).value;

            var num2=document.getElementById(“n2”).value;

            var num1=parseInt(num1);

            var num2=parseInt(num2);

            var sum=num1+num2;

            document.getElementById(‘result’).value=sum;

      }

      function mul() {

                  var num1=document.getElementById(“n1”).value;

                  var num2=document.getElementById(“n2”).value;

                  document.getElementById(‘result’).value=num1*num2;

      }

      function sub() {

                  var num1=document.getElementById(“n1”).value;

                  var num2=document.getElementById(“n2”).value;

                  document.getElementById(‘result’).value=num1-num2;

      }

      function div() {

                  var num1=document.getElementById(“n1”).value;

                  var num2=document.getElementById(“n2”).value;

                  document.getElementById(‘result’).value=num1/num2;

      }

</script>

</body>

</html>