Jensen's Device: Difference between revisions

m (→‎{{header|REXX}}: changed a comment.)
(→‎{{header|ALGOL 60}}: Section added)
Line 62:
5.18738E+00
</pre>
=={{header|ALGOL 60}}==
Honor given where honor is due.
'''begin'''
'''integer''' i;
'''real procedure''' sum (i, lo, hi, term);
'''value''' lo, hi;
'''integer''' i, lo, hi;
'''real''' term;
'''comment''' term is passed by-name, and so is i;
'''begin'''
'''real''' temp;
temp := 0;
'''for''' i := lo '''step''' 1 '''until''' hi '''do'''
temp := temp + term;
sum := temp
'''end''';
'''comment''' note the correspondence between the mathematical notation and the call to sum;
print (sum (i, 1, 100, 1/i))
'''end'''
 
 
=={{header|ALGOL 68}}==
{{trans|ALGOL 60}}
1,392

edits