Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
50
Task/General-FizzBuzz/Crystal/general-fizzbuzz.crystal
Normal file
50
Task/General-FizzBuzz/Crystal/general-fizzbuzz.crystal
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
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
|
||||
end
|
||||
end
|
||||
else
|
||||
exit
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue