Computer ForumsComputers  

Go Back   Computer Forums > Programmers Lounge > Programming Discussions > Programming Tips and FAQ

Reply
 
LinkBack Thread Tools Display Modes
Old 11-26-2007, 10:31 PM   #1 (permalink)
Newb Techie
 
Join Date: Oct 2007
Location: In a hole.
Posts: 26
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 10:36 PM. Reason: Probably wrong forum...
TheCorsairMalack is offline   Reply With Quote
Old 11-27-2007, 12:30 AM   #2 (permalink)
Newb Techie
 
Join Date: Oct 2007
Location: In a hole.
Posts: 26
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   Reply With Quote
Reply

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 Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -5. The time now is 04:13 AM.


Powered by vBulletin® Version 3.7.1
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.1.0