I am trying to do arithmetic operation based on radio button value.
<html>
  <body>
    <br>Enter first number:
    <input type="text" id="txt1" name="text1">Enter second number:
    <input type="text" id="txt2" name="text2">
    
    <form>
      <input type="radio" name="oper" value="1" checked>Add
      <br>
      <input type="radio" name="oper" value="2">Multiply
      <br>
      <input type="radio" name="oper" value="3">Subtract
    </form> 
    <p id="demo"></p>
    <script>
      function myFunction() {
        var y = document.getElementById("txt1").value;
        var z = document.getElementById("txt2").value;
 var o = getCheckedRadioValue("oper");
 if(+o == 1)
         var x = +y + +z;
 
 if(+o == 2)
  var x = +y * +z;
  
 if(+o == 3)
  var x = +y - +z;
  
  
     
 
        document.getElementById("demo").innerHTML = x;
      
    </script>
    <button onclick="myFunction()">Calculate</button>
    <br/>
  </body>
</html> 
     
     
    