Answers for "simple calculator in javascript using switch case"

5

killing a port mac

sudo lsof -i :3000
Posted by: Guest on April-29-2020
0

simple calculator in javascript using switch case

var num1 = parseInt(prompt("Enter a number:"));
var num2 = parseInt(prompt("Enter another number:"));
var operand = prompt("Enter an operand:");

switch(operand) {
  case "+":
    document.write("Answer: " + (num1 + num2));
    break;
  case "-":
    document.write("Answer: " + (num1 - num2));
    break;
  case "*":
    document.write("Answer: " + (num1 * num2));
    break;
  case "/":
    document.write("Answer: " + (num1 / num2));
    break;
}
Posted by: Guest on October-29-2021

Code answers related to "simple calculator in javascript using switch case"

Code answers related to "Javascript"

Browse Popular Code Answers by Language