0
Need help with If Else "admission in pairs"
https://www.sololearn.com/learning/1024/1137/1398/1 I am able to get test cases 1-4 a green check mark with the following code, but am unable to get get Test Case 5 corrected. the code: function main() { var numberGuests = parseInt(readLine(), 10) // Your code here var pair = 2; if (pair = numberGuests/2%2 == 0) { console.log('Right'); } else { console.log('Wrong'); } } When I change the "if (pair = numberGuests/2%2 == 0)" to have a 1 instead of a 0, then cases 2, 4, and 5 check correct, but not 1 and 3. Can someone help me understand what I am doing incorrectly in this exercise?
1 Odpowiedź
+ 1
I think it's not necessary to declare variable pair.
if (numberGuests%2==0)