Soloway's recurring rainfall: Difference between revisions
Content added Content deleted
(Added Quackery.) |
Drkameleon (talk | contribs) (added Arturo) |
||
Line 101: | Line 101: | ||
END |
END |
||
</syntaxhighlight> |
</syntaxhighlight> |
||
=={{header|Arturo}}== |
|||
<syntaxhighlight lang="arturo">i: 0 |
|||
sum: 0 |
|||
while ø [ |
|||
n: input "Enter rainfall as integer (99999 to quit): " |
|||
try? -> n: to :integer n |
|||
else [ |
|||
print "Input must be an integer." |
|||
continue |
|||
] |
|||
if 99999 = n -> break |
|||
'i + 1 |
|||
'sum + n |
|||
print ~« The current average rainfall is |sum // i|. |
|||
]</syntaxhighlight> |
|||
{{out}} |
|||
<pre>Enter rainfall as integer (99999 to quit): 145 |
|||
The current average rainfall is 145.0. |
|||
Enter rainfall as integer (99999 to quit): 43678 |
|||
The current average rainfall is 21911.5. |
|||
Enter rainfall as integer (99999 to quit): 9 |
|||
The current average rainfall is 14610.66666666667. |
|||
Enter rainfall as integer (99999 to quit): 155 |
|||
The current average rainfall is 10996.75. |
|||
Enter rainfall as integer (99999 to quit): 99999</pre> |
|||
=={{header|BASIC}}== |
=={{header|BASIC}}== |