C
C#3y 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);
}
}
}
}
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);
}
}
}
}
0 Replies
No replies yetBe the first to reply to this messageJoin
Want results from more Discord servers?
Add your server