100 REM Greatest Common Divisor Program 110 PRINT "Compute the GCD of two integers." 120 REM 130 PRINT "Enter the first number." 140 INPUT A 150 PRINT "Enter the second number." 160 INPUT B 161 REM Save A and B for later output. 162 LET A2 = A 163 LET B2 = B 170 REM If B is larger, then swap the inputs. 180 IF A > B THEN 240 190 LET T = A 200 LET A = B 210 LET B = T 220 REM ------------------------------------- 230 REM Begin main computation loop. 240 LET R = A MOD B 250 IF R = 0 THEN 310 260 LET A = B 270 LET B = R 280 GOTO 230 290 REM 300 REM Done with computation; print the answer. 310 PRINT "The GCD of "; A2; " and "; B2; " = " B 320 PRINT 330 END