[ create a new paste ] login | about

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

Ruby, pasted on Jul 25:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
sum = 0

MyArray = [5, 7, 19.8]

length = MyArray.length

i = 0

length.times{
sum = sum + MyArray[i]
i = i + 1
}

puts sum


Output:
1
31.8


Create a new paste based on this one


Comments: