Hallo:
Die Entwicklungsumgebung Eclipse gibt immer einen Fehelr aus, dass bei der public boolean istprim ein ; fehlt...
Code
/*
* Created on 10.06.2005
*
* TODO To change the template for this generated file go to
* Window - Preferences - Java - Code Style - Code Templates
*/
/**
* @author Stefan
*
* TODO To change the template for this generated type comment go to
* Window - Preferences - Java - Code Style - Code Templates
*/
public class primzahlenanzahl {
public static void main(String[] args) {
System.out.print("Geben Sie zwei Zahlen ein: ");
int zahl1 = Kbd.readInt();
int zahl2 = Kbd.readInt();
int anzahl = 0;
int x = 0;
for(int i = zahl1; i < zahl2; i++){
int zahl = istprim(i);
if(zahl == true){
anzahl++;
}
}
public boolean istprim(x){
for(int i = 2; i < x; i++ ){
int rest = x % i;
if(rest != 0){
return true;
}
else {
return false;
}
}
}
}
}
Alles anzeigen