1
0
mirror of https://github.com/mbirth/gwbasic.git synced 2024-11-13 00:36:46 +00:00
gwbasic/PRIMZAHL/PRIMFAST.BAS

56 lines
1.5 KiB
QBasic
Raw Normal View History

1995-12-14 18:19:08 +00:00
10 CLS
20 COLOR 15
30 INPUT"Geben Sie den Maximalwert f<>r die Primzahlen an:",MAX
40 CLS
50 DIM V(MAX)
60 B=12
70 C=1
80 A=1
90 U=1
100 FOR Z=1 TO A
110 Y=A/Z
120 LOCATE 1,1:PRINT "Akt. Ergebnis: ";Y;" "
130 LOCATE 2,1:PRINT "Mom. Teiler : ";Z;" "
140 LOCATE 3,1:PRINT " schon ";X;"x geteilt "
150 LOCATE 4,1:PRINT "Akt. Zeile : ";B-11;" "
160 LOCATE 5,1:PRINT "Primzahlen : ";(C-1)/5;" "
170 LOCATE 6,1:PRINT "Akt. Zahl : ";A;"von ";MAX;" "
180 LOCATE 7,1:PRINT " Noch ";MAX-A;" Werte "
190 LOCATE 11,1:PRINT SPACE$(80)
200 IF Y=INT(Y) THEN X=X+1
210 IF X>2 THEN 250
220 IF X=2 AND Z<A THEN 250
230 NEXT Z
240 IF X=2 OR A=1 THEN GOSUB 300
250 X=0
260 A=A+1
270 IF A>MAX THEN LOCATE 23,1:GOTO 390
280 IF W=1 THEN GOSUB 360:W=0
290 GOTO 100
300 REM Unterroutine
310 LOCATE 3,33:SOUND 2000,.5
320 COLOR 12,0,0:PRINT"Primzahl gefunden...":COLOR 14,0,0
330 X=0:LOCATE B,C:PRINT A:C=C+5:IF C>75 THEN C=1:B=B+1:IF B>23 THEN B=12:C=1
340 V(U)=A:U=U+1:W=1
350 RETURN
360 REM Unterroutine
370 COLOR 15,0,0:LOCATE 3,33:PRINT" "
380 RETURN
390 REM Endroutine
400 PRINT"Wenn fertig Taste dr<64>cken..."
410 A$=INKEY$:IF A$="" THEN 410
420 CLS
430 COLOR 14,0,0
440 A=1
450 B=1
460 C=1
470 FOR Z=1 TO MAX
480 IF V(Z)=0 THEN GOTO 510
490 LOCATE B,C:PRINT V(Z)
500 C=C+5:IF C>75 THEN B=B+1:C=1:IF B>23 THEN B=1
510 NEXT Z
520 COLOR 10
530 LOCATE 23,1:PRINT"Wenn bereit Taste dr<64>cken..."
540 A$=INKEY$:IF A$="" THEN 540
550 CLS:COLOR 15,0,0