If statements | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

If statements

Whats the problem for this code of this task ? eEntrance to the club is only permitted in pairs. Take the number of customers in the club as input, and, if all of them have a pair, output to the console "Right", otherwise output "Wrong". Sample Input 14 Sample Output Right function main() { var numberGuests = parseInt(readLine(), 10) if (numberGuests%2 = 0) { document.write(Right); } else { document.write(Wrong); } }

27th Nov 2020, 12:05 PM
Yasamin Kholafaei
Yasamin Kholafaei - avatar
3 Answers
+ 3
Yasamin Kholafaei , change first the if condition to numberGuests % 2 === 0, then "Right" and "Wrong" should be in quotes. For console output use console.log () method instead of document.write ().
27th Nov 2020, 12:08 PM
TheWh¡teCat 🇧🇬
TheWh¡teCat 🇧🇬 - avatar
+ 1
//let 'n' represent our number of remainders var n = numberGuests % 2; if(n == "0") console.log("Right"); else{console.log("Wrong");} Or you can say for short If(numberGuests % 2 == "0") console.log("Right"); else{console.log("wrong");}
9th Jun 2021, 1:22 AM
Chukwuemeka Okore
Chukwuemeka Okore - avatar
0
Write a program that checks if the water is boiling. Take the integer temperature in Celsius as input and output "Boiling" if the temperature is above or equal to 100.
28th Feb 2022, 4:15 PM
Venkata Ramana
Venkata Ramana - avatar