Etwas
public text v1 · immutable#include <iostream.h>
#include <conio.c>
#include <time.h>
int eingabe, teilzahl, i, berechnung;
void main () {
cout << "Geben Sie eine Zahl ein um zu ueberpruefen ob sie eine Primzahl ist ";
cin >> eingabe;
teilzahl = 1;
for (i = 2; i < eingabe; i ++) {
if (eingabe % i == 0) {
teilzahl ++;
}
}
if (teilzahl > 2) {
cout << "keine Primzahl" << endl;
}
else {
cout << "Primzahl gefunden!" << endl;
}
getch();
}