Why can't I pass difficulty levels?? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Why can't I pass difficulty levels??

I wrote everything perfect, but it always gives me an error. Can you please give me the code so I could pass. Here is my code: using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace SoloLearn { class Program { static void Main(string[] args) { int num = Convert.ToInt32(Console.ReadLine()); /* 1 - Easy 2 - Medium 3 - Hard other - "Invalid option" */ switch (num) { case 1: Console.WriteLine("Easy"); break; case 2: Console.WriteLine("Medium"); break; case 3: Console.WriteLine("Hard"); break; default: Console.WriteLine("Invalid option"); break; } } } https://code.sololearn.com/c7BQd78OjelW/?ref=app

8th Jun 2022, 9:49 AM
Остап Сінченко
Остап Сінченко - avatar
8 Answers
+ 8
The switch statement body was missing its closing curly bracket.
8th Jun 2022, 10:03 AM
Ipang
+ 5
You can test your code on sololearn playground: Go to Code section, click +, select the programming language, insert your code, click Run.
8th Jun 2022, 10:17 AM
Lisa
Lisa - avatar
+ 4
You might wanna show your attempt, so people can give you specific help (Edit: he did now). Afterall it is about learning and not about passing levels Moreover it is helpful to state which prgramming language you tried it and what specific problem is
8th Jun 2022, 9:52 AM
Alexander Thiem
Alexander Thiem - avatar
+ 2
Attach your tryout code bit link in the post Description above. https://www.sololearn.com/post/75089/?ref=app
8th Jun 2022, 9:52 AM
Ipang
+ 2
Ipang, it made it even worse
8th Jun 2022, 10:09 AM
Остап Сінченко
Остап Сінченко - avatar
+ 2
Остап Сінченко You are not informing the errors. This makes helping you a guessing game. Plus, the wall of code also make it harder to debug. Do change that to a link to your code in Code Playground. Put people closer to your issue, and you'll be closer to the solution.
8th Jun 2022, 10:59 AM
Emerson Prado
Emerson Prado - avatar
+ 2
Остап Сінченко I tried Ipang suggestion and it fixed the problem. What do you mean by "it made it even worse"?
8th Jun 2022, 11:52 AM
Emerson Prado
Emerson Prado - avatar
+ 1
You missed a closing curly brace for namespace SoloLearn..!!
9th Jun 2022, 1:32 AM
Sasi Kumar
Sasi Kumar - avatar