Last active
August 29, 2015 14:13
-
-
Save jessedhillon/f2b5aa45fee801e63525 to your computer and use it in GitHub Desktop.
Calculator example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var number1 = parseFloat(prompt("Enter the first number")); | |
var number2 = parseFloat(prompt("Enter the second number")); | |
var operation = prompt("Choose one of +, -, *, /") | |
var result; | |
if(operation == "+") { | |
result = number1 + number2; | |
} else if(operation == "-") { | |
result = number1 - number2; | |
} else if(operation == "*") { | |
result = number1 * number2; | |
} else if(operation == "/") { | |
result = number1 / number2; | |
} | |
alert(result); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment