Soloway's recurring rainfall: Difference between revisions
→{{header|ALGOL 68}}: Allow for negative rainfall
No edit summary |
(→{{header|ALGOL 68}}: Allow for negative rainfall) |
||
Line 76:
<syntaxhighlight lang="algol68">
BEGIN # read a sequence of integers, terminated by 99999 and outpout their average #
INT end value = 99999;
INT sum := 0;
INT count := 0;
BOOL invalid value := FALSE;
on value error( stand in, ( REF FILE f )BOOL: invalid value := TRUE );
WHILE
INT n := 0;
WHILE
print( ( "Enter rainfall (integer) or ", whole( end value, 0 ), " to quit: " ) );
read( (
THEN▼
DO
print( ( "Invalid input, please enter an integer", newline ) );
OD;
n /= end value
|