-
-
Save ellismarte/5f47f6a859db6a5afd03 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
def calculate(input, output) | |
array_of_nums = input.split("").map! {|num| num.to_i} | |
operators = [+, -, *, /] | |
operators.each do |op| | |
array_of_nums.each_with_index do |num, index| | |
p num op array_of_nums[index..array_of_nums.length].join('').to_i | |
end | |
end | |
end | |
calculate("314159265358", 27182) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment