Calculate prime numbers in qbasic O.o

Status
Not open for further replies.

TheCorsairMalack

Baseband Member
Messages
26
I've been playing with this program (it's my first) with Qbasic. It is supposed to calculate whether a number that the user puts in is a prime number. But now that I've gotten pretty far along on it I realize that I need to have it divide the user's number by all the prime numbers lower than its square root. To do this I would either need to have a list of lower prime numbers that it would divide by, or have it calculate all the low prime numbers (the goal of the program in the first place!)

I don't know how to make Qbasic check the "divisibility" or if it even can. I've been trying to find it using google and all the Qbasic sites I can find. If you know how to make Qbasic check whether "X is divisible by Y" please let me know! Thanks for reading this post.



EDIT: Urk! I just realized I'm in the sub-forum... Sorry if this isn't the place for this thread.
 
Whooohooooo!!!!!

After a few hours of scratching a pencil in a calculus text book and messing around, I found out how to do it using step and absolute value [STEP, ABS()]
Woot! I'm happy now.

Kill this thread.
 
Status
Not open for further replies.
Back
Top Bottom