Hallo,
habe folgendes Problem: Wir sollen in unserem Info Kurs ein programm schreiben das alle Primzahlen von 0-100ausgibt. Das ganze soll mit einer Methode passieren. Hier ist der Code:
Wenn ich das jetzt compilieren will kommt folgende Meldung:
C:/------.java:21:6:21:14: Semantic Error:
No applicable overload for a methos with signature "ggT(int)" was found in type "Primzahlen". Perhaps you wanted the overloaded version "int ggT(int a,b);" instead?
Aber wenn ich das änder, kommt: Unexpected symbol ignored.
Hoffe jemand kann mir helfen
dankeschön
exxo.
habe folgendes Problem: Wir sollen in unserem Info Kurs ein programm schreiben das alle Primzahlen von 0-100ausgibt. Das ganze soll mit einer Methode passieren. Hier ist der Code:
Java:
public class Primzahlen {
public static int ggT(int a, int b) {
while(a!=b){
if(a<b){
a=a+b;
b=a-b;
a=a-b;
}
else {
a=a-b;
}
}
return a;
}
public static void main(String[] args){
int zahl;
zahl=Console.in.readInt();
if(ggT(zahl)) {
Console.out.println("Es ist eine Primzahl");
}
else{
Console.out.println("Es ist keine Primzahl");
}
}
}
Wenn ich das jetzt compilieren will kommt folgende Meldung:
C:/------.java:21:6:21:14: Semantic Error:
No applicable overload for a methos with signature "ggT(int)" was found in type "Primzahlen". Perhaps you wanted the overloaded version "int ggT(int a,b);" instead?
Aber wenn ich das änder, kommt: Unexpected symbol ignored.
Hoffe jemand kann mir helfen
dankeschön
exxo.