7 kyu

Find factors of a number

901 of 2,143zCo

Description:

Create a function that takes a number and finds the factors of it, listing them in descending order in an array.

If the parameter is not an integer or less than 1, return -1. In C# return an empty array.

For Example: factors(54) should return [54, 27, 18, 9, 6, 3, 2, 1]

Sorting
Arrays
Fundamentals

Stats:

CreatedNov 20, 2015
PublishedNov 20, 2015
Warriors Trained3446
Total Skips160
Total Code Submissions9215
Total Times Completed2143
JavaScript Completions832
Python Completions901
Ruby Completions159
CoffeeScript Completions14
C# Completions330
Total Stars31
% of votes with a positive feedback rating89% of 310
Total "Very Satisfied" Votes253
Total "Somewhat Satisfied" Votes45
Total "Not Satisfied" Votes12
Ad
Contributors
  • zCo Avatar
  • jhoffner Avatar
  • CrazyMerlyn Avatar
  • Jotha Avatar
  • kazk Avatar
  • hobovsky Avatar
  • saudiGuy Avatar
Ad