Weiter komme ich nicht :(
ALLE GERADEN ZAHLEN
ZahlV = wo es startet also hier bei 8
ZahlB = bis zu welcher Zahl in diesem Fall 20
und es soll dan so aussehen:
4: 2
6: 2, 3
8: 4, 2
.
.
.
.........
int Testteiler = 0; int ZahlV = 8; int ZahlB = 20; int Teiler = 2; int cZahl = ZahlV;
while (ZahlV < ZahlB) {
while (Teiler < ZahlV) {
if (ZahlV % Teiler == 0) {
System.out.println(ZahlV + ": " + Teiler);
}
Teiler++;
}
if (cZahl == ZahlV) {
System.out.print("," + Teiler);
}
ZahlV++;
cZahl++;
}
System.out.println(ZahlV + ": " + Testteiler);
}
}