pwnt by pat
10+ year member
Pat for Prez 2024 - vote!
I am bored at school, so I decided to write a program listing the prime number sequence to a given amount. It works quite well, except the ouput I'm given. I haven't programed with QB for five or six years, so I'm a little rusty. what I want to do is get the output text file in comma seperated value form. Currently, it puts each value on it's own line. If anyone knows anything, please, feel free to lend me a hand.
I just realized it's not the fibonacci sequence, it's the sequence of numbers only evenly divisible by themselves and 1, prime numbers.
Here's the code:
I just realized it's not the fibonacci sequence, it's the sequence of numbers only evenly divisible by themselves and 1, prime numbers.
Here's the code:
CLSOPEN "fib.txt" FOR OUTPUT AS #1
PRINT "Number of sequence:"
INPUT q
x = 1
z = 0
DIM seq(1 TO q)
DO
FOR i = 2 TO 5
IF x / i = x \ i THEN
z = 1
END IF
IF (x = 2 OR x = 3 OR x = 5) THEN z = 0
NEXT i
IF z = 0 THEN seq(x) = x
x = x + 1
z = 0
LOOP UNTIL x = (q + 1)
FOR i = 1 TO q
IF seq(i) 0 THEN
PRINT seq(i)
WRITE #1, seq(i)
END IF
NEXT
END
