+ 1

Where is error?

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()); Int e = 1; Int m = 2; Int h = 3; 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; } } } }

27th Oct 2020, 11:30 AM
_Forman_
_Forman_ - avatar
1 Odpowiedź
+ 1
c# is case-sensitive and the case of int, switch, and "case" is wrong. Here is a fixed version of your 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()); int e = 1; int m = 2; int h = 3; 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; } } } }
27th Oct 2020, 8:04 PM
Josh Greig
Josh Greig - avatar