Created
April 24, 2022 12:13
-
-
Save asonnleitner/bc9aff10d8e72f9940a0db9ee5260b93 to your computer and use it in GitHub Desktop.
This file contains 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
MAX_LENGTH = 4 | |
zlomky = Array.new | |
puts "Zadejte zlomky:" | |
10.times do |i| | |
zlomek = Hash.new | |
zlomek["citatel"] = gets.chomp.to_i | |
zlomek["jmenovatel"] = gets.chomp.to_i | |
zlomky.push(zlomek) | |
if zlomky.length != 10 | |
puts "Zadejte dalsi zlomek" | |
end | |
end | |
def zarovnane(zlomky) | |
puts "" | |
zlomky.each do |zlomek| | |
puts " | |
#{zlomek["citatel"].to_s.rjust(MAX_LENGTH)} | |
#{"-" * MAX_LENGTH} | |
#{zlomek["jmenovatel"].to_s.rjust(MAX_LENGTH)} | |
" | |
end | |
puts "" | |
end | |
zarovnane(zlomky) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment