Averages/Pythagorean means: Difference between revisions
→{{header|Common Lisp}}
Basicgames (talk | contribs) |
|||
Line 795:
(format t "g-mean ~a~%" g-mean)
(format t "h-mean ~a~%" h-mean)))</syntaxhighlight>
=={{header|Craft Basic}}==
<syntaxhighlight lang="basic">precision 6
define bxsum = 1, sum = 0, sum1i = 0
define average = 0, geometric = 0, harmonic = 0
let i = 1
do
let sum = sum + i
let bxsum = bxsum * i
let sum1i = sum1i + ( 1 / i )
let i = i + 1
loop i < 11
let average = sum / 10
let geometric = bxsum ^ ( 1 / 10 )
let harmonic = 10 / sum1i
print "arithmetic mean: ", average
print "geometric mean: ", geometric
print "harmonic mean: ", harmonic
if average >= geometric and geometric >= harmonic then
print "true"
end
endif
print "false'
end</syntaxhighlight>
=={{header|D}}==
|