Averages/Root mean square: Difference between revisions
Content added Content deleted
m (<lang> needs a language) |
|||
Line 824: | Line 824: | ||
end |
end |
||
puts rms (1..10).to_a # => 6.2048368229954285</lang> |
puts rms (1..10).to_a # => 6.2048368229954285</lang> |
||
=={{header|Run BASIC}}== |
|||
<lang runbasic>valueList$ = "1 2 3 4 5 6 7 8 9 10" |
|||
while word$(valueList$,i +1) <> "" ' grab values from list |
|||
thisValue = val(word$(valueList$,i +1)) ' turn values into numbers |
|||
sumSquares = sumSquares + thisValue ^ 2 ' sum up the squares |
|||
i = i +1 ' |
|||
wend |
|||
print "List of Values:";valueList$;" containing ";i;" values" |
|||
print "Root Mean Square =";(sumSquares/i)^0.5</lang> |
|||
Output: |
|||
List of Values:1 2 3 4 5 6 7 8 9 10 containing 10 values |
|||
Root Mean Square =6.20483682 |
|||
=={{header|Sather}}== |
=={{header|Sather}}== |