|
|
DataMuseum.dkPresents historical artifacts from the history of: MIKADOS |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about MIKADOS Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - download
Length: 764 (0x2fc)
Notes: Mikados TextFile, Mikados_K
Names: »PRIMTAL«
└─⟦92e6f589c⟧ Bits:30003895/4xCOMAL3b.imd 4 * COMAL - SPC/1 - Disketter til bogen
└─⟦this⟧ »PRIMTAL«
└─⟦faca42ef2⟧ Bits:30003895/4xCOMAL1.imd 4 * COMAL - SPC/1 - Disketter til bogen
└─⟦this⟧ »PRIMTAL«
0010 // ------------------- prim ------------------------ 0015 INTEGER TRUE,FALSE,TAL 0016 TRUE:=1;FALSE:=0 0020 // 0030 CLEAR 0035 PRINT 0040 INPUT "Hvilket tal skal undersøges: ":TAL 0050 PRINT 0060 PRIMTAL:=FALSE 0070 IF TAL>1 AND TAL=INT(TAL) THEN 0080 PRIMTAL:=TRUE 0090 GRÆNSE:=SQR(TAL)+0.5 0100 IF TAL/2=INT(TAL/2) AND TAL>2 THEN 0110 PRIMTAL:=FALSE 0120 PRINT TAL," er et lige tal" 0130 ENDIF 0140 DIVISOR:=1 0150 IF TAL<>3 THEN 0160 WHILE PRIMTAL=TRUE AND DIVISOR<=GRÆNSE DO 0170 DIVISOR:=DIVISOR+2 0180 IF TAL-(INT(TAL/DIVISOR))*DIVISOR=0 THEN TEST:=FALSE 0190 IF NOT PRIMTAL THEN PRINT TAL," har ",DIVISOR," som divisor" 0200 ENDWHILE 0210 ENDIF 0220 ENDIF 0230 IF PRIMTAL THEN 0240 PRINT TAL;" er et primtal" 0250 ELSE 0260 PRINT TAL;" er ikke et primtal" 0270 ENDIF