1 REM Get biggest common divisor of scrWidth and scrHeight (Euclidean Algorithm,) compute aspect ratio 10 LET scrWidth = 1024 20 LET scrHeight = 768 30 LET a = scrWidth 40 LET b = scrHeight 50 LET c = 0 100 IF (scrWidth < scrHeight) THEN 130 110 LET a = scrHeight 120 LET b = scrWidth 130 REM end if 200 REM start loop (SWAP a, b) 210 LET c = a 220 LET a = b 230 LET b = c 250 REM another loop 260 LET a = a - b 270 IF (a >= b) THEN 250 280 IF (a <> 0) THEN 200 290 PRINT "The aspect ratio of "; scrWidth; "x"; scrHeight; " is "; scrWidth / b; ":"; scrHeight / b 300 END
Return to Example Index