C#C
C#4y ago
med5801

what is the easiest way to make a prime number finder

using System;

using System.Threading;

namespace asal_sayı_bulucu
{
    class Program
    {
        static void Main(string[] args)
        {
            int a = 0;
            int sayi = 2;
            while (sayi<1000)
            {
                for (int i = 1; i < sayi; i++)
                {
                    if (sayi % i == 0)
                    {
                        a++;
                    }
                }
                if (a==1)
                {
                    Console.WriteLine(sayi);
                    sayi++;  
                }
                else
                {
                    sayi++;
                }
                a = 0;
                Thread.Sleep(1);
            }
        }
    }
}
Was this page helpful?