[ create a new paste ] login | about

Link: http://codepad.org/tLtSsKBQ    [ raw code | output | fork ]

sdcoolio@gmail.com - Ruby, pasted on Aug 30:
1
2
3
4
5
6
7
8
9
def sum_sq(*nums)
	max_nums = []
	max_nums << nums.max
	nums.delete(nums.max)
	max_nums << nums.max
	return max_nums[0]**2 + max_nums[1]**2
end

puts sum_sq(1,2,3,4,5)


Output:
1
41


Create a new paste based on this one


Comments: