JavaScript required
We’re sorry, but Coda doesn’t work properly without JavaScript enabled.
Skip to content
Gallery
Puzzle #9: Calculator
Puzzle #9: Calculator
Bonus Challenges
More
Share
Explore
Bonus Challenges
If you got this far and want to keep going, try including some of this additional functionality that most calculators support, in order of difficulty:
Add C and AC buttons.
C should clear the current value and AC should reset the entire calculation
Operations on the result of a calculation.
For example, entering “1+4=x2=” should result in
10
.
Changing the operator, if you pressed the wrong one by mistake.
For example, entering “5-+2=” should result in
7.
Chaining operations, so you don’t need to press = every time.
For example, entering “1+2x4=/6+2=” should result in 4
Support operating on a number with itself, so you don’t have to retype it.
For example, entering “1+=” should result in 2
Support performing the same operation multiple times.
For example, entering “1+3====” should result in 13
Want to print your doc?
This is not the way.
Try clicking the ⋯ next to your doc name or using a keyboard shortcut (
Ctrl
P
) instead.