Averages/Arithmetic mean: Difference between revisions

m
Line 859:
 
=={{header|Craft Basic}}==
<syntaxhighlight lang="basic">'versiondim a[3, 1:, using4, 1, an5, array9]
 
dim a[3, 1, 4, 1, 5, 9]
 
arraysize s, a
Line 871 ⟶ 869:
next i
 
print t / s</syntaxhighlight>
{{out| Output}}<pre>3.83</pre>
 
end</syntaxhighlight>
 
<syntaxhighlight lang="basic">'version 2: without using an array
 
input "how many numbers to average? ", n
 
for i = 1 to n
 
input "enter a number: ", s
let a = a + s
 
next i
 
print "average: ", a / n
 
end</syntaxhighlight>
 
=={{header|Crystal}}==
305

edits