Ich habe folgendes Programm gegeben:
import java.util.Scanner;
public class Primzahl {
public static void main(String[] args) {
Scanner myscan = new Scanner(System.in); // Scanner definieren
int summe = 0;
int i = 1;
int p;
System.out.println("Bitte geben Sie eine beliebige Zahl ein!!");
int zahl = myscan.nextInt(); // beliebige Zahl-Eingabe
do { // do while Schleife
if(zahl < 2) {
break; //aus der do-while-Schleife raus springen
}
p = zahl % i; // modulo : eingegeben Zahl mod i
if (p == 0) {
summe = summe + i;
}
i++;
} while (i < zahl);
if (summe == 1) {
System.out.println("ist Primzahl");
}
else {
System.out.println("ist keine Primzahl");
}
}// Hauptprogramm
}// class
Kann mir jemand erklären, was dieser Programmteil
p = zahl % i; // modulo : eingegeben Zahl mod i
if (p == 0) {
summe = summe + i;
}
aussagt?