Skip to content

Commit

Permalink
Add square root exercie
Browse files Browse the repository at this point in the history
  • Loading branch information
wolf99 committed Oct 7, 2019
1 parent dab442f commit 33d31cc
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 0 deletions.
54 changes: 54 additions & 0 deletions exercises/square-root/canonical-data.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
{
"exercise": "square-root",
"version": "1.0.0",
"cases": [
{
"description": "root of 1",
"property": "squareRoot",
"input": {
"radicand": 1
},
"expected": 1
},
{
"description": "root of 4",
"property": "squareRoot",
"input": {
"radicand": 4
},
"expected": 2
},
{
"description": "root of 25",
"property": "squareRoot",
"input": {
"radicand": 25
},
"expected": 5
},
{
"description": "root of 81",
"property": "squareRoot",
"input": {
"radicand": 81
},
"expected": 9
},
{
"description": "root of 196",
"property": "squareRoot",
"input": {
"radicand": 196
},
"expected": 14
},
{
"description": "root of 65025",
"property": "squareRoot",
"input": {
"radicand": 65025
},
"expected": 255
}
]
}
7 changes: 7 additions & 0 deletions exercises/square-root/description.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Given a natural radicand, return its square root.

Check out the Wikipedia pages on [square root](https://en.wikipedia.org/wiki/Square_root) and [methods of computing square roots](https://en.wikipedia.org/wiki/Methods_of_computing_square_roots).

Recall that natural numbers are positive real whole numbers (i.e. 1, 2, 3 and up).

When implementing this in a language with a built-in square root function, implement your own function.
4 changes: 4 additions & 0 deletions exercises/square-root/metadata.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
blurb: "Given a natural radicand, return its square root."
source: ""
source_url: ""

0 comments on commit 33d31cc

Please sign in to comment.