wes d2a2ba9e15 first commit 4 tahun lalu
..
README.md d2a2ba9e15 first commit 4 tahun lalu
code.cpp d2a2ba9e15 first commit 4 tahun lalu
unitTest.cpp d2a2ba9e15 first commit 4 tahun lalu

README.md

Basic Calculator

by Matt tags: algebra, math, numbers

Summary

Create a function that takes two numbers and a mathematical operator + - / * and will perform a calculation with the given numbers. Examples calculator(2, '+', 2) ➞ 4 calculator(2, '*', 2) ➞ 4 calculator(4, '/', 2) ➞ 2 Notes If the input tries to divide by 0, return 0.

Instructions

Create a function that takes two numbers and a mathematical operator + - / * and will perform a calculation with the given numbers.

Examples

calculator(2, '+', 2) ➞ 4

calculator(2, '*', 2) ➞ 4

calculator(4, '/', 2) ➞ 2

Notes

If the input tries to divide by 0, return 0.