|
-
Oct 11th, 2001, 10:46 AM
#1
Thread Starter
Fanatic Member
Recursive Function
if someone from C programing knows how to print first 10 prime nos. using recursion, pls let me know.
also let me know if this is possible in VB 
regards,
prakash
-
Oct 11th, 2001, 01:48 PM
#2
Well ...
Recursion is definitely possible in VB, so you can write such a program.
Also I don't have a ready code and am too lazy to write it on the fly, so I can't give you a ready code.
.
-
Oct 11th, 2001, 02:43 PM
#3
Addicted Member
Why not just work out the first 10 numbers and stick 'em in an array?! It just seems like such a waste of processing for 10 primes!
Excepting 1:
2,3,5,7,11,13,17,19,23,29
PS, I found VB a bit slow for this kind of task up to any "reasonable" number (unless you've got a "resonable processor, but C's still the best bet - write it into a DLL).
-
Oct 11th, 2001, 09:48 PM
#4
Well ...
The use of recursion is tomorrow if you need the first 100 prime numbers, you just need to change a couple of lines, at the most.
Using your technique it would not be possible to extend the program.
.
-
Oct 12th, 2001, 12:48 AM
#5
Addicted Member
Ah, don't get me wrong, Honeybee - recursion is a very useful method of producing repetitive results, but VB isn't the pretiest of languages (bit like Swan Lake in full plate armour). I just believe that VB isn't really the language for such routines - you need to have VB code as compact and quick as possible.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|