2008-09-23 配列の要素の値を合計 Ruby arry = [1,2,3,4,5,6,7,8,9,10] total = 0 arry.each do |i| total = total.to_i + i.to_i end puts "合計:" + total.to_s + "\n"