My grandfather always predicted how old people would get, and right before he passed away he revealed his secret!
In honor of my grandfather's memory we will write a function using his formula!
Take a list of ages when each of your great-grandparent died.
Multiply each number by itself.
Add them all together.
Take the square root of the result.
Divide by two.
Example
predictAge(65, 60, 75, 55, 60, 63, 64, 45) === 86
Note: the result should be rounded down to the nearest integer.
'매일매일개발 > Codewars' 카테고리의 다른 글
codewars #69 Weight for weight (5kyu) (0) | 2018.06.28 |
---|---|
codewars #68 Predict your age! (7kyu) (0) | 2018.06.27 |
codewars #66 Inside Out Strings (6kyu) (0) | 2018.06.22 |
codewars #65 Split Strings (6kyu) (0) | 2018.06.21 |
codewars #64 Strip Comments (4kyu) (0) | 2018.06.20 |