Created
March 31, 2014 20:21
-
-
Save brewster1134/9901348 to your computer and use it in GitHub Desktop.
2520
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# What's the smallest number divisible be all of 1, 2, 3, 4, 5, 6, 7, 8, and 9? | |
require 'colorize' | |
def check_num num | |
(num % 9 == 0) && (num % 8 == 0) && (num % 7 == 0) && (num % 6 == 0) | |
end | |
multiple = 10 | |
current_num = multiple | |
until check_num current_num | |
puts "#{current_num} NO...".red | |
current_num += multiple | |
end | |
puts "#{current_num} YES!!!".green |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment