Mark Wickens

5 ONERRORGOTO1000
10 MODE8:DIM:c$=CHR$(5):a=1:b=1
20 CLS:PRINT"G.C.M. & L.C.M.  (1≤a,b<10¹⁰)";
30 s$="a":z=a:GOSUB700:a=z
40 s$="b":z=b:GOSUB700:b=z:CLS
100 IFb>a THENf=b:g=a ELSEf=a:g=b
110 h=f-INT(f/g)*g:IFh THENf=g:g=h:GOTO110
200 l=a/g*b:PRINT"G.C.M.=";g;TAB(0);"L.C.M.=";l;:z$=INPUT$(1,@):GOTO20
700 LOCATE0,1:PRINTc$;s$;"=";z;"?";:INPUT@11;z:LOCATE0,0:z=ABSz
730 IFz>=1e10 ORz<1 ORFRACz<>0 THEN700 ELSERETURN
1000 IFERR=1 THENCLS:ONERRORGOTO0
1010 IFERL=700 THENRESUME700
1050 LOCATE0,1:PRINTc$;"not found";:z$=INPUT$(1,@):RESUME20