Created
November 11, 2023 00:56
-
-
Save hachy/c5a5d0918b1037a285dbf7493384f874 to your computer and use it in GitHub Desktop.
Display prices within a 10% to -10% range of the original price.
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
v = 1234 | |
10.downto(-10) do |i| | |
print (v * (1 + (i * 0.01))).round | |
puts "#{i}%".rjust(5) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment