Prime factors in 25 lines or less - Printable Version +- Qbasicnews.com (http://qbasicnews.com/newforum) +-- Forum: QbasicNews.Com (http://qbasicnews.com/newforum/forum-3.html) +--- Forum: Challenges (http://qbasicnews.com/newforum/forum-10.html) +--- Thread: Prime factors in 25 lines or less (/thread-8202.html) |
Prime factors in 25 lines or less - whodat - 10-07-2005 In 25 lines or less, write a program in QBasic that lists the prime factors of any positive integer. The program prompts the user for a number, then prints to the screen: "The prime factors are:", and then lists them. If the entered number is already prime, it will be the only number listed. The number 1 is not considered prime. Statements separated by colons are considered separate lines. For checking purposes, if you enter 987654321, the list should read: 3,3,17,17,379721 Prime factors in 25 lines or less - Rattrapmax6 - 10-08-2005 You might want to have a no : rule,. other wise someone could do it in one line.... At least with FBIde or NotePad,. I think QB's IDE had a 260 cross limit or something... :wink: Edit: Oops, sorry, you did, I missed that line... :oops: Prime factors in 25 lines or less - Agamemnus - 10-08-2005 Someone with one post? Smells like homework... NM my solution..edited. I think I'll wait a day or so.. from an ageing newbie - whodat - 10-09-2005 Everyone has a first post ...and I wish I were young enough to have homework! :o Prime factors in 25 lines or less - Agamemnus - 10-09-2005 Well, your words, your stringent output conditions, and your spelling suggests otherwise. . . . . . Tell us a little about your line of work.. Prime factors in 25 lines or less - whodat - 10-09-2005 My words, my spelling...Ah!, I see. You're one of those arrogant nerds who hides behind a computer monitor and snipes at others. I think that my best course is to ignore your words. :barf: Prime factors in 25 lines or less - neuro - 10-09-2005 Code: INPUT "enter a number: ", x& - neuro Prime factors in 25 lines or less - speedlemon - 10-09-2005 Quote:My words, my spelling...Ah!, I see. You're one of those arrogant nerds who hides behind a computer monitor and snipes at others. I think that my best course is to ignore your words. :barf:... Agamemnus is just making an observation about your language and you should give a little more respect to him. I had a chance to get to know him a few years ago and he turned out to be a pretty nice (and helpful) guy. Prime factors in 25 lines or less - Agamemnus - 10-09-2005 That wasn't very nice. Did I call you an arrogant noob? No... Anyway, I posted mine in the FAQ, so I guess I'll post it again since neuro volunteered his code.. Code: CLS Prime factors in 25 lines or less - whodat - 10-09-2005 Quote:whodat Wrote:My words, my spelling...Ah!, I see. You're one of those arrogant nerds who hides behind a computer monitor and snipes at others. I think that my best course is to ignore your words. :barf:... Ok, he's a nice guy. He just had a rather peculiar way of introducing himself. |