wes d2a2ba9e15 first commit | 4 years ago | |
---|---|---|
.. | ||
README.md | 4 years ago | |
code.cpp | 4 years ago | |
unitTest.cpp | 4 years ago |
by Helen Yu tags: math, numbers, control_flow, loops
Create a function that takes a number as its argument and returns an array of all its factors. Examples factorize(12) ➞ [1, 2, 3, 4, 6, 12] factorize(4) ➞ [1, 2, 4] factorize(17) ➞ [1, 17] Notes The input integer will be positive. A factor is a number that evenly divides into another number without leaving a remainder. The second example is a factor of 12,
Create a function that takes a number as its argument and returns an array of all its factors.
factorize(12) ➞ [1, 2, 3, 4, 6, 12]
factorize(4) ➞ [1, 2, 4]
factorize(17) ➞ [1, 17]