5 'PFACTORS.BAS -- for GWBasic or QBAsic 10 GOTO 500 100 LOCATE 15, 15: PRINT "Number to be factored is "; 110 INPUT N 120 IF N <= 1 THEN 300 130 LOCATE 20, 1: PRINT " " 150 B = 0 160 FOR I = 2 TO N / 2 170 IF N / I > INT(N / I) THEN 250 180 B = B + 1 190 IF B > 1 THEN 210 200 LOCATE 20, 1: PRINT "Prime factors of "; N; " are "; 210 PRINT I; 220 N = N / I 230 IF N = 1 THEN 280 240 I = I - 1 250 NEXT I 270 LOCATE 20, 1: PRINT N; " is a prime number " 280 LOCATE 15, 26: PRINT " " 290 GOTO 100 300 CLS : KEY ON: END 310 ' 500 CLS 510 KEY OFF 520 TOPSIDE\$ = CHR\$(201) + STRING\$(29, CHR\$(205)) + CHR\$(187) 530 BOTTOM\$ = CHR\$(200) + STRING\$(29, CHR\$(205)) + CHR\$(188) 540 TITLE\$ = " PRIME FACTORS OF AN INTEGER " 550 TITLE1\$ = " " 560 TITLE2\$ = " H. Heinz Sept. 1985 " 570 PRINT TAB(23); TOPSIDE\$ 580 PRINT TAB(23); CHR\$(186); TITLE\$; CHR\$(186) 590 PRINT TAB(23); CHR\$(186); TITLE1\$; CHR\$(186) 600 PRINT TAB(23); CHR\$(186); TITLE2\$; CHR\$(186) 610 PRINT TAB(23); BOTTOM\$ 620 PRINT 630 PRINT TAB(21); "This program finds the Prime Factors" 640 PRINT TAB(21); "of the number input. Enter 1 to quit." 650 PRINT TAB(21); "Your integer may contain up to 7 digits." 655 PRINT TAB(21); "Enter 0 to end program." 660 GOTO 100 670 'USES GW BASIC 680 'NAME IS PFACTORS.BAS 690 'CAN'T USE DOUBLE PRECISION BECAUSE 'FOR' WON'T WORK IN D.P. 700 'TRY 9699690,7864320