Sum of a series: Difference between revisions
→{{header|ALGOL 68}}: Corrected the range of the summation and formatted the output.
(Sum of a series en Yabasic) |
(→{{header|ALGOL 68}}: Corrected the range of the summation and formatted the output.) |
||
Line 125:
=={{header|ALGOL 68}}==
<lang algol68>MODE RANGE = STRUCT(INT lwb, upb);
Line 141 ⟶ 136:
test:(
RANGE range = (1,
PROC f = (INT x)LONG REAL: LENG REAL(1) / LENG REAL(x)**2;
print(("Sum of f(x) from ", whole(lwb OF range, 0), " to ",whole(upb OF range, 0)," is ", fixed(SHORTEN sum(f,range),-8,5),".", new line))
)</lang>
Output:
<pre>
Sum of f(x) from
</pre>
|