1
0
mirror of https://github.com/mbirth/gwbasic.git synced 2024-11-10 07:16:46 +00:00
gwbasic/PRIMZAHL/PRIMF2.BAS

70 lines
1.8 KiB
QBasic
Raw Normal View History

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