HIGHER MATH
Your ATARI Computer is a fancy calculator. When you enter two
numbers into the program
below, the computer will tell you their
greatest common denominator. For
example, if you enter 690911 and
11214017,
you'll soon discover that their greatest common
denominator is 53147.
J.O ?
CHR$
(J.25)
:?
"En"ter
"two
nUMbers.
Press
Re"turn
af"ter
each
en"tr!.l
• "
20
INPUT
NJ.
..
N2
30
GOSUB
~O
40?
"Their
GCD
is
"
;:?
AN
50
POKE
752
..
J.:
POSITION
J.O
..
J.O:
?
"Press
S"tar"t"to
con"tinue."
60
IF
PEEK(5327~)<)6
THEN
GOTO
60
70
POKE
752
..
0:
?
CHR$
(J.25)
:
GOTO
J.O
80
REM
****SUBROUTINE****
~O
AN=O:POKE
J.~5
..
0:TRAP
J.30:
M=(NJ.)=N2)*NJ.+(N2)NJ.)*N2:
N=(M=NJ.)*N2+(M=N2)*NJ.
J.OO
IF
INT
(NJ.)
<
)NJ.
OR
INT
(N2)
<
)N2
THEN
RETURN
J.J.O
P=M-INT
(M/N
)*N:
M=N:
N=P
J.20
IF
P<)O
THEN
GOTO
J.J.O
J.30
AN=M*(PEEK(J.~5)=0):
RETURN
83