G
glausi
Gast
Guten abend, ich will mit einer Minimumsuche unter java aus 3 Zahlen das Minimum suchen. Aber hab immernoch nen Fehler drin, vllt könnt ihr mir helfen.
Code:
public class MinimumSuche{
public static void main(String[] args){
double a=Double.parseDouble(args[0]);
double b=Double.parseDouble(args[1]);
double c=Double.parseDouble(args[2]);
double Min;
if(args.length !=3) {
System.out.println("Fehler:Bitte geben sie 3 Kommandozeilenparameter ein!");
}else{
System.out.println("Zahl1: "+a+" Zahl2: "+b+" Zahl3: "+c);
Min=minSuche(a,b,c);
System.out.printl(Min);
}
}
}
public static double minSuche(double a, double b, double c){
if(a<=b && a<=c){
return a;
}else if(b<=a && b<=c){
return b;
}else if(c<=a && c<=b){
return c;
}
}
}