Skip to content

layla-lili/JSFoundations-Conditionals

 
 

Repository files navigation

Task

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.

Task Steps

  1. Fork and clone this repository
  2. Open the repo folder in Visual Studio Code.
  3. In calculator.js, create an integer variable for the first number.
  4. Create a second integer variable for the second number.
  5. Create a third string variable for the operation (addition "+", subtraction "-", multiplication "*", or division "/").
  6. Use if-statements to check which operation the third variable has.
  7. Perform the mathematical operation on the two numbers, and print the result to the console.

Submission

To submit your work, simply push your code to GitHub.

Steps

After finishing the task and verifying your work, follow these steps to push your code to GitHub:

  1. Navigate to project root (where calculator.js is).
  2. Run the command git add .
  3. Run git commit -m "Solved the Conditionals task".
  4. Push to GitHub: git push.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • JavaScript 54.7%
  • TypeScript 45.3%