Skip to content

Instantly share code, notes, and snippets.

@jubishop
Last active September 29, 2015 04:31
Show Gist options
  • Save jubishop/493789107e9416568a3a to your computer and use it in GitHub Desktop.
Save jubishop/493789107e9416568a3a to your computer and use it in GitHub Desktop.
puts 'What number shall we find factors for? '
number_to_factor = gets.to_i
puts "Factors for #{number_to_factor} are:"
1.upto(number_to_factor) { |number_to_test|
if (number_to_factor % number_to_test == 0)
puts number_to_test
end
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment