Advertisement
biswasrohit20

cal

Mar 13th, 2021
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. var c = prompt("Calculate Program \n1. Add numbers \n2. Subtract numbers \n3. Multiply numbers \n4. Divide numbers \nWhat's your choice ?")
  2.  
  3. var num1 = parseInt(prompt("Enter the first number "))
  4.  
  5. var num2 = parseInt(prompt("Enter the second number "))
  6. if (c == 1) {
  7. console.log(num1 + num2)
  8. } else if (c == 2) {
  9. console.log(num1 - num2)
  10. } else if (c == 3) {
  11. console.log(num1 * num2)
  12. } else if (c == 4) {
  13. console.log(num1 / num2)
  14. }
  15.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement