+ 2
Hi Pro players this is leveling up question!
In this question only the first case is not run, but 4 cases has been done Please help me to complete the first case https://code.sololearn.com/cA8YB4eZPfPg/?ref=app
5 Réponses
+ 3
if(points>=80)
{
Console.WriteLine("Level completed");
if(points>=90)
Console.WriteLine("Extra gift");
}
else
Console.WriteLine("You lost");
+ 2
Thanks to everyone. Solved
+ 1
else is only related to the if statement directly before it, for multiple branches use "else if"
Your order of branches is wrong (I guess since task description is missing). Or you could use different conditions.
This should be fixed:
if(points>=90)
Console.WriteLine("Extra gift");
else if(points>=80)
Console.WriteLine("Level completed");
else
Console.WriteLine("You lost");
+ 1
Thanks for the help that took a long time
0
Why not use parentheses?