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
Printable View
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
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.
.
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).
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.
.
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.