Skip to content

Instantly share code, notes, and snippets.

@bloudermilk
Created April 2, 2014 04:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bloudermilk/9928199 to your computer and use it in GitHub Desktop.
Save bloudermilk/9928199 to your computer and use it in GitHub Desktop.
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