mean( list_of_numbers )
length <-- length of list_of_numbers
index <-- 1
sum <-- 0
while index <= length {
sum <-- sum + list_of_numbers[index]
index <-- index + 1
}
return sum / length
example input :
mean ( 1 2 3 4 )
length <-- 4
index <-- 1
sum <-- 0
list_of_numbers[1] = 1
list_of_numbers[2] = 2
list_of_numbers[3] = 3
list_of_numbers[4] = 4
[toggle title="Answer" float="left" width="100px" margin="0 20px 20px 0" status="closed"] 2.5 [/toggle]
source : SCHAUM’S OUTLINE OF Principles of COMPUTER SCIENCE