1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
|
int main()
{
int VarMax = 100; //Alle Zahlen bis 100 auf Primzahlen testen
int Divisor;
int Divident = 3;
BOOL IsPrime;
for (Divident = 3; Divident <= VarMax; Divident++)
{
IsPrime = FALSE;
Divisor = 2;
do
{
if (Divident % Divisor == 0) IsPrime = FALSE;
Divisor++;
} while ((Divisor < Divisor / 2) && (IsPrime))
if (IsPrime) printf("%d\n", Divident);
}
}
|