+ 2
Тhe result of an exam will be determined as follows։ If the score is 88 and above => excellent 40-87 => good 0-39 => fail
var score = parseInt(readLine(), 10) /* 88 and above => excellent 40-87 => good 0-39 => fail */ if((score >= 88) && (score>89)){ console.log("excellent") } else if((score>=40) && (score<88)){ console.log("good") } else{ ((score>=0) && (score<=39)) console.log("fail") It only fails when input 88. Please, help me
6 ответов
+ 4
Remove the and part of the initial condition, its unnecessary and causing only 90+ to be excellent
+ 4
var score = parseInt(readLine(), 10)
/*
88 and above => excellent
40-87 => good
0-39 => fail
*/
// your code goes here
if(score >=88) console.log("excellent"); else if (score >=40 && score <88) console.log("good"); else console.log("fail");
+ 2
In first 'if' write:
...score>=88 (no need to write the second one:- score>89)
In second 'else if' write:
...score<=87
0
Thank you very much, I've removed && (score>89) and it works.
0
var score = parseInt(readLine(), 10)
/*
88 and above => excellent
40-87 => good
0-39 => fail
*/
// your code goes here
if(score >= 88){
console.log("excellent");
}else if((score >= 40)&&(score <= 87)){
console.log("good");
}else{
console.log("fail");
}
0
var score = parseInt(readLine(), 10)
if(score>=88)
{
console.log("exellent")
}
else if((score>=40) && (score<88));
{
console.log("good ");
}
else
{
console.log("fail");
}