-2

But there is a mistake and I can't find it. Plese help me!

let r=(gets());
let t=(gets());
let y=(gets());

let a=parseFloat(r);
let b=parseFloat(t);
let c=parseFloat(y);

if (a>==b && a>==c) { 
    print(a); 
} else if (b>==a && b>==c) {
    print(b); 
} else {
    print(c);
}
Federico klez Culloca
  • 26,308
  • 17
  • 56
  • 95
jdk
  • 1
  • 1

2 Answers2

1

I think you are having a SyntaxError because in Javascript the comparison operators are these ones : https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Expressions_and_Operators#Comparison

So here is how you write your conditions:

if (a>=b && a>=c) { 
    console.log(a); 
} else if (b>=a && b>=c) {
    console.log(b); 
} else {
    console.log(c);
}
Fiorila
  • 65
  • 7
1

You could take a nested approach and check only two values for each if statement.

if (a > b) {
    if (a > c) {
        console.log(a);
    } else {
        console.log(c);
    }
} else {
    if (b > c) {
        console.log(b);
    } else {
        consol.log(c);
    }
}
Nina Scholz
  • 376,160
  • 25
  • 347
  • 392