In this task, you'll create a calculator that has two numbers and an operation, and the calculator will perform the operation on those two numbers.
You'll create an integer variable that contains the first number, another integer variable that contains the second number, and a third string variable that contains the operation.
Example, the two numbers could be 3
and 5
, and the operation could be "+"
, then the calculator will add 3
and 5
, and print to the console 3 + 5 = 8
.
- Fork and clone this repository
- Open the repo folder in Visual Studio Code.
- In
calculator.js
, create an integer variable for the first number. - Create a second integer variable for the second number.
- Create a third string variable for the operation (addition
"+"
, subtraction"-"
, multiplication"*"
, or division"/"
). - Use
if-statements
to check which operation the third variable has. - Perform the mathematical operation on the two numbers, and print the result to the console.
To submit your work, simply push your code to GitHub.
After finishing the task and verifying your work, follow these steps to push your code to GitHub:
- Navigate to project root (where
calculator.js
is). - Run the command
git add .
- Run
git commit -m "Solved the Conditionals task"
. - Push to GitHub:
git push
.