TPK algorithm: Difference between revisions

Content deleted Content added
use the <source> tag
The algorithm: insert <source lang="pascal"> tag </source> for ALGOL 60 wiith some pre-ascii characters.
Line 6:
 
==The algorithm==
In [[ALGOL 60]]:
 
<source lang="pascal">
<code>
'''begin integer''' i; '''real''' y; '''real array''' a[0:10];
'''real procedure''' f(t); '''real''' t; '''value''' t;
f := sqrt(abs(t))+5*t^35×t↑3;
'''for''' i := 0 '''step''' 1 '''until''' 10 '''do''' read(a[i]);
'''for''' i := 10 '''step''' -1 '''until''' 0 '''do'''
'''begin''' y := f(a[i]);
'''if''' y > 400 '''then''' write(i, "TOO LARGE")
'''else''' write(i,y);
'''end'''
'''end'''
</codesource>
 
The algorithm reads eleven numbers from an input device, stores them in an array, and then processes them in reverse order, applying a user-defined function to each value and reporting either the value of the function or a message to the effect that the value has exceeded some threshold.