Click here to Skip to main content
16,015,623 members
Home / Discussions / C#
   

C#

 
GeneralRe: Creating databases programmatically Pin
Sourie27-Jan-08 23:39
Sourie27-Jan-08 23:39 
GeneralI need help with prime numbers. Pin
Alex50126-Jan-08 11:03
Alex50126-Jan-08 11:03 
GeneralRe: I need help with prime numbers. Pin
Paul Conrad26-Jan-08 12:10
professionalPaul Conrad26-Jan-08 12:10 
GeneralRe: I need help with prime numbers. Pin
DaveyM6926-Jan-08 12:51
professionalDaveyM6926-Jan-08 12:51 
GeneralRe: I need help with prime numbers. Pin
Paul Conrad26-Jan-08 13:12
professionalPaul Conrad26-Jan-08 13:12 
GeneralRe: I need help with prime numbers. Pin
Luc Pattyn26-Jan-08 14:51
sitebuilderLuc Pattyn26-Jan-08 14:51 
GeneralRe: I need help with prime numbers. Pin
Alex50126-Jan-08 18:05
Alex50126-Jan-08 18:05 
GeneralRe: I need help with prime numbers. Pin
GuyThiebaut26-Jan-08 13:18
professionalGuyThiebaut26-Jan-08 13:18 
I wrote a prime class for myself some time ago - so I just dug this out of my archives.
It's not the best algorithm, in terms of speed, however it works.
Make sure you understand how it works because when your tutor comes to ask you how it works...
class Prime
{

    public static bool isPrime(double numIn)
    {

        double testNum;
        double testLimit;

        testLimit = numIn;
        testNum = 3;

        if (0 == testLimit % 2)
        {
            return false;
        }

        while (testLimit > testNum)
        {

            if (0 == numIn % testNum)
            {
                return false;
            }

            testLimit = numIn / testNum;
            testNum += 2;

        }//while (testLimit > testNum)

        return true;

    }//isPrime

}//Prime


You always pass failure on the way to success.


GeneralRe: I need help with prime numbers. Pin
Luc Pattyn26-Jan-08 14:52
sitebuilderLuc Pattyn26-Jan-08 14:52 
GeneralRe: I need help with prime numbers. Pin
GuyThiebaut26-Jan-08 22:52
professionalGuyThiebaut26-Jan-08 22:52 
GeneralRe: I need help with prime numbers. Pin
Alex50126-Jan-08 18:13
Alex50126-Jan-08 18:13 
GeneralRe: I need help with prime numbers. Pin
PIEBALDconsult26-Jan-08 15:57
mvePIEBALDconsult26-Jan-08 15:57 
GeneralRe: I need help with prime numbers. Pin
Luc Pattyn26-Jan-08 16:18
sitebuilderLuc Pattyn26-Jan-08 16:18 
GeneralIC Programmer with C#. Pin
hdv21226-Jan-08 8:20
hdv21226-Jan-08 8:20 
GeneralRe: IC Programmer with C#. Pin
DaveyM6926-Jan-08 8:37
professionalDaveyM6926-Jan-08 8:37 
GeneralRe: IC Programmer with C#. Pin
Spacix One26-Jan-08 9:19
Spacix One26-Jan-08 9:19 
GeneralRe: IC Programmer with C#. Pin
hdv21226-Jan-08 11:02
hdv21226-Jan-08 11:02 
Questioncreating logger based on threads and queue Pin
kriskris26-Jan-08 3:43
kriskris26-Jan-08 3:43 
GeneralRe: creating logger based on threads and queue Pin
Paul Conrad26-Jan-08 5:42
professionalPaul Conrad26-Jan-08 5:42 
GeneralRe: creating logger based on threads and queue Pin
Adeel Chaudhry26-Jan-08 6:29
Adeel Chaudhry26-Jan-08 6:29 
GeneralAppDomain with non domain-neutral assemblies Pin
Softbal26-Jan-08 3:25
Softbal26-Jan-08 3:25 
GeneralBrowser Help Object BeforNavigate problem Pin
sepel25-Jan-08 23:30
sepel25-Jan-08 23:30 
GeneralWindows right click menu... Pin
anderslundsgard25-Jan-08 23:04
anderslundsgard25-Jan-08 23:04 
GeneralRe: Windows right click menu... Pin
Abhijit Jana25-Jan-08 23:24
professionalAbhijit Jana25-Jan-08 23:24 
GeneralRe: Windows right click menu... Pin
DaveyM6925-Jan-08 23:29
professionalDaveyM6925-Jan-08 23:29 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.