Data update
This commit is contained in:
parent
5150844a7d
commit
4bb20c9b71
7735 changed files with 38060 additions and 199180 deletions
|
|
@ -1,50 +1,12 @@
|
|||
counter = 0
|
||||
|
||||
puts "Enter a maximum number:"
|
||||
limit = gets
|
||||
|
||||
puts "Enter the first integer for factoring:"
|
||||
first_int = gets
|
||||
puts "Enter the name of the first integer:"
|
||||
first_int_name = gets
|
||||
|
||||
puts "Enter the second integer for factoring:"
|
||||
second_int = gets
|
||||
puts "Enter the name of the second integer:"
|
||||
second_int_name = gets
|
||||
|
||||
puts "Enter the third integer for factoring:"
|
||||
third_int = gets
|
||||
puts "Enter the name of the third integer:"
|
||||
third_int_name = gets
|
||||
|
||||
if (limit &&
|
||||
first_int &&
|
||||
second_int &&
|
||||
third_int &&
|
||||
first_int_name &&
|
||||
second_int_name &&
|
||||
third_int_name)
|
||||
limit = limit.chomp.to_i
|
||||
first_int = first_int.chomp.to_i
|
||||
second_int = second_int.chomp.to_i
|
||||
third_int = third_int.chomp.to_i
|
||||
while limit > counter
|
||||
counter += 1
|
||||
if (counter % first_int) == 0 && (counter % second_int) == 0 && (counter % third_int) == 0
|
||||
puts first_int_name + second_int_name + third_int_name
|
||||
elsif (counter % first_int) == 0 && (counter % second_int) == 0
|
||||
puts first_int_name + second_int_name
|
||||
elsif (counter % first_int) == 0
|
||||
puts first_int_name
|
||||
elsif (counter % second_int) == 0
|
||||
puts second_int_name
|
||||
elsif (counter % third_int) == 0
|
||||
puts third_int_name
|
||||
else
|
||||
puts counter
|
||||
def fizz_buzz_plus (factorwords, limit)
|
||||
factorwords = factorwords.sort_by { |f, w| f }
|
||||
(1..limit).each do |n|
|
||||
shout = ""
|
||||
factorwords.each do |factor, word|
|
||||
shout += word if n % factor == 0
|
||||
end
|
||||
puts (shout == "" ? n : shout)
|
||||
end
|
||||
else
|
||||
exit
|
||||
end
|
||||
|
||||
fizz_buzz_plus [{3, "Fizz"}, {5, "Buzz"}, {7, "Baxx"}], 20
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue