Need help with If Else "admission in pairs" | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
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?

4th Apr 2021, 5:18 AM
Buff Cat
Buff Cat - avatar
1 Answer
+ 1
I think it's not necessary to declare variable pair. if (numberGuests%2==0)
4th Apr 2021, 5:31 AM
Simba
Simba - avatar