-
-
Save bloudermilk/9928199 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 input_get | |
input = gets.chomp | |
sum[i] = input.to_i | |
end | |
def sum | |
sum = [] | |
i = 0 | |
puts input_get | |
while input!='' | |
puts input_get | |
i+=1 | |
end | |
sum=sum.inject(:+) | |
puts sum | |
end | |
# def sum(nums) | |
# total = 0 | |
# i = 0 | |
# while i < nums.count | |
# total += nums[i] | |
# i += 1 | |
# end | |
# # return total | |
# total | |
# end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment