+ 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

12th Jan 2022, 12:56 PM
josé manuel
josé manuel - avatar
6 Antworten
+ 4
Remove the and part of the initial condition, its unnecessary and causing only 90+ to be excellent
12th Jan 2022, 1:23 PM
AnonyMouse
AnonyMouse - avatar
+ 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");
6th Oct 2022, 11:12 PM
Isaac Noe Álvarez González
+ 2
In first 'if' write: ...score>=88 (no need to write the second one:- score>89) In second 'else if' write: ...score<=87
12th Jan 2022, 1:26 PM
NEZ
NEZ - avatar
0
Thank you very much, I've removed && (score>89) and it works.
13th Jan 2022, 4:17 PM
josé manuel
josé manuel - avatar
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"); }
21st Feb 2023, 3:42 PM
Lan Thu
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"); }
3rd Mar 2023, 3:08 PM
Sudhanshu Vidyarthi
Sudhanshu Vidyarthi - avatar