Atari 65XE Owner's Manual page 88

Hide thumbs Also See for 65XE:
Table of Contents

Advertisement

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.
10 ? CHR$(125) :? "Enter two numbers. Press Return after
each entry. "
20 INPUT N 1 , N 2
30 GOSUB 90
40 ? "Their GCD is "; :? AN
50 POKE 752,1:POSITION 10,10: ? "Press Start to
continue."
60 IF PEEK(53279)<>6 THEN GOTO 60
78 POKE 752,0:? CHR$(125) :GOTO 10
80 REM ****SUBROUTINE****
90 A N = 0 : P O K E 195,0:TRAP 130: M=(N1>=N2)*N1+(N2>N1)*N2:
N=(M=N1)*N2+(M=N2)*N1
100 IF INT(N1)<>N1 OR INT (N2)<>N2 THEN R E T U R N
110 P=M-INT (M/N)*N:M=N:N=P
120 IF P < > 0 THEN GOTO 110
130 AN=M*(PEEK(195)=0):RETURN
83

Advertisement

Table of Contents
loading

Table of Contents