+ 1

(C#) can anyone explain me what I did wrong?

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; } } } } I did it how I learned, and I don't know if I just have a typing error or if I'm just dumb

7th May 2022, 6:49 AM
Timerin
Timerin - avatar
3 Respostas
+ 3
Timerin You just missed semicolon in 3rd case
7th May 2022, 7:54 AM
A͢J
A͢J - avatar
+ 2
Worked, thx m8
7th May 2022, 8:20 AM
Timerin
Timerin - avatar
0
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; int num = Convert.ToInt32(Console.ReadLine()); switch(num){ case 1: Console.WriteLine("Easy"); break; case 2: Console.WriteLine("Medium"); break; case 3: Console.WriteLine("Hard"); break; deafult: Console.WriteLine("Invalid option"); break; } } } }
7th Sep 2022, 5:09 AM
Parthasarathi U
Parthasarathi U - avatar