Hi all
I'm trying to write a program that gives the biggest of 3 numbers (integers) and this is the error I get "operator > cannot be applied to boolean, int" Could someone tell me what am I doing wrong? cuz a similar code works for just 2 numbers.
Here's the code
import acm.program.*;
public class ProgramaMayorDe3 extends DialogProgram {
public static void main(
String[] args) {
new ProgramaMayorDe3().start();
}
public void run() {
int x;
int y;
int z;
x = this.readInt("Dame el primer numero:");
y = this.readInt("Dame el segundo numero:");
z = this.readInt("Dame el tercer numero:");
int r = this.mayor(x, y, z);
this.println("El mayor entre " + x + " , " + y + " y " + z + " es: " + r);
}
public int mayor(int a, int b, int c) {
if (a > b > c) {
return a;
} if (a < b > c) {
return b;
} else {
return c;
}
}
}