IBM 1620 Manual page 47

Hide thumbs Also See for 1620:
Table of Contents

Advertisement

Diagramming the Problem
Writing the FORTRAN
Statements
46
Problem: Evaluate f(x)
Given: Values for a, b, c, and d punched on a card, and
a set of values for the variable x punched one per card
Evaluate the function defined by
aX2 + bX
+
C
if
X
<
d
f(X)
=
o
if
X
=
d
-ax
2
+
bX -C
if
X
>
d
for each value of x, and print the value of x and f ( x ) .
A block diagram of a possible
FORTRAN
program to solve this problem follows:
Compute
f(x) = ax 2
+
bx
+
C
x.<
d
Set
f(x)
=
0
x>d
Compute
f(x)
=
_ax 2
+
bx - C
The
FORTRAN
statements to solve this problem are shown in the coding chart
which follows. In this problem, statement numbers required by the logic of the
program are either 1 or 2 digits; statements with 3-digit numbers are numbered
only for the purpose of explanation here, and would not need to be numbered
in an actual program.
The first statement is a comment which will appear on source program
listings. A comment statement must be identified by placing a C in
column one of the coding form.
Statement 100 causes the first four cards to be read and the values
punched in those cards to be assigned sequentially to A, B, C, and D.
This statement references
FORMAT
statement 7, which specifies that each

Advertisement

Table of Contents
loading

Table of Contents