Posted by: programmervb on: March 6, 2009
‘ look at a series of numbers and print out the prime numbers
‘ prime numbers are divisible only by unity or themselves
‘ this is BCX basic, a modern successor to Qbasic
Dim A ‘ defaults to integer
For A = 1 To 100
If IsPrime(A) Then Print A;
Next
Pause ‘ make console wait
Function IsPrime(Num)
Local X
‘ make exeptions for unity [...]
Posted by: programmervb on: March 6, 2009
DECLARE SUB GetWords (st$, wds%)
st$ = “Hello my name is John Doe”
IF RIGHT$(st$, 1) <> ” ” THEN st$ = st$ + ” “
FOR k% = 1 TO LEN(st$)
IF MID$(st$, k%, 1) = ” ” THEN words% = words% + 1
characters% = characters% + 1
NEXT
PRINT “total characters=”; characters%
PRINT “total words=”; words%
xst$ = “Hello my name [...]
Posted by: programmervb on: August 16, 2008
‘Multiply Matrix
1040 ‘multiply matrix module
1050 CLS:INPUT “BANYAK BARIS,BANYAK KOLOM MATRIX 1″;P,Q
1060 INPUT “BANYAK BARIS,BANYAK KOLOM MATRIX 2″;R,S
1070 IF Q<>R THEN PRINT “TIDAK TERDEFINISI”:STOP:GOTO 1050
1080 DIM A(P,Q),B(R,S),C(P,S)
1090 PRINT:PRINT”ELEMEN MATRIX 1:”:PRINT
1100 FOR I=1 TO P:FOR J=1 TO A:PRINT”BARIS”;I;”KOLOM”;J;:INPUT A(I,J):NEXT J,I
1110 PRINT:PRINT”ELEMEN MATIRX 2:”:PRINT
1120 FOR I=1 TO R:FOR J=1 TO S:PRINT”BARIS”;I;”KOLOM”;K;:INPUT B(I,J):NEXT J,I
1130 FOR I=1 TO P
1140 FOR [...]