mirror of
https://github.com/mbirth/gwbasic.git
synced 2024-11-09 23:06:45 +00:00
48 lines
1.1 KiB
QBasic
48 lines
1.1 KiB
QBasic
|
10 CLS
|
|||
|
20 INPUT"Geben Sie den Maximalwert f<>r die Primzahlen an:",MAX
|
|||
|
30 CLS
|
|||
|
40 DIM V(MAX)
|
|||
|
50 B=5
|
|||
|
60 C=1
|
|||
|
70 A=1
|
|||
|
80 U=1
|
|||
|
90 FOR Z=1 TO A
|
|||
|
100 Y=A/Z
|
|||
|
110 LOCATE 1,1:PRINT Y;" "
|
|||
|
120 LOCATE 2,1:PRINT A;" "
|
|||
|
130 IF Y=INT(Y) THEN X=X+1
|
|||
|
140 NEXT Z
|
|||
|
150 IF X=2 OR A=1 THEN GOSUB 210
|
|||
|
160 X=0
|
|||
|
170 A=A+1
|
|||
|
180 IF A>MAX THEN LOCATE 23,1:GOTO 310
|
|||
|
190 IF W=1 THEN GOSUB 280:W=0
|
|||
|
200 GOTO 90
|
|||
|
210 REM Unterroutine
|
|||
|
220 LOCATE 3,1:SOUND 2000,.5
|
|||
|
230 COLOR 12,0,0:PRINT"Primzahl gefunden...":COLOR 14,0,0
|
|||
|
240 X=0:LOCATE B,C:PRINT A:C=C+5:IF C>75 THEN C=1:B=B+1
|
|||
|
250 V(U)=A:U=U+1
|
|||
|
260 COLOR 15,0,0:LOCATE 3,1:PRINT"Primzahl gefunden..."
|
|||
|
270 RETURN
|
|||
|
280 REM Unterroutine
|
|||
|
290 COLOR 15,0,0:LOCATE 3,1:PRINT"Primzahl gefunden..."
|
|||
|
300 RETURN
|
|||
|
310 REM Endroutine
|
|||
|
320 PRINT"Wenn fertig Taste dr<64>cken..."
|
|||
|
330 A$=INKEY$:IF A$="" THEN 330
|
|||
|
340 CLS
|
|||
|
350 COLOR 14,0,0
|
|||
|
360 A=1
|
|||
|
370 B=1
|
|||
|
380 C=1
|
|||
|
390 FOR Z=1 TO MAX
|
|||
|
400 IF V(Z)=0 THEN GOTO 430
|
|||
|
410 LOCATE B,C:PRINT V(Z)
|
|||
|
420 C=C+5:IF C>75 THEN B=B+1:C=1
|
|||
|
430 NEXT Z
|
|||
|
440 COLOR 10
|
|||
|
450 LOCATE 23,1:PRINT"Wenn bereit Taste dr<64>cken..."
|
|||
|
460 A$=INKEY$:IF A$="" THEN 460
|
|||
|
470 CLS:COLOR 15,0,0
|
|||
|
|