Computer Forums

Member Login

Remember Me? Sign Up! | Forgot Password
 
Slogan
 
Closed Thread
Old 11-26-2007, 11:31 PM   #1 (permalink)
 
Newb Techie

Join Date: Oct 2007

Posts: 26

TheCorsairMalack is on a distinguished road

Question Calculate prime numbers in qbasic O.o

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.

Last edited by TheCorsairMalack; 11-26-2007 at 11:36 PM. Reason: Probably wrong forum...
TheCorsairMalack is offline  
Old 11-27-2007, 01:30 AM   #2 (permalink)
 
Newb Techie

Join Date: Oct 2007

Posts: 26

TheCorsairMalack is on a distinguished road

Talking Re: Calculate prime numbers in qbasic O.o

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.
TheCorsairMalack is offline  
 
Closed Thread

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On
Trackbacks are On
Pingbacks are On
Refbacks are On