Soloway's recurring rainfall: Difference between revisions
m
→{{header|Raku}}: copy / pasto, add missing line, reformat slightly
Thundergnat (talk | contribs) m (→{{header|Raku}}: copy / pasto, add missing line, reformat slightly) |
|||
Line 567:
I notice that units are specified for neither measurement; time nor rainfall accumulation. Time is assumed to always increment in units of one, rainfall in some non-negative integer. "Integer" gets a little leeway in this entry. Floating point numbers or Rational numbers that are exactly equal to an Integer are allowed, even if they are technically not integers.
<syntaxhighlight lang="raku" line># Write a program that will read in integers and
# output their average. Stop reading when the
Line 585 ⟶ 583:
++$periods;
$accumulation += $rainfall;
say-it;
printf "Average rainfall %.2f units over %d time periods.\n", $accumulation / $periods, $periods;▼
}
say-it;
▲sub say-it
{{out}}
<pre># Normal operation
|