wes d2a2ba9e15 first commit преди 4 години
..
README.md d2a2ba9e15 first commit преди 4 години
code.cpp d2a2ba9e15 first commit преди 4 години
unitTest.cpp d2a2ba9e15 first commit преди 4 години

README.md

Factorize a Number

by Helen Yu tags: math, numbers, control_flow, loops

Summary

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,

Instructions

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, because 12 / 2 = 6, with remainder 0.