Maha

Maha

  • NA
  • 0
  • 324k

Switch Statement

Mar 5 2013 4:01 PM
This Switch Statement is not compiling. Please tell what is the wrong with it?

using System;
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Enter Rating(1-10): ");
int n = int.Parse(Console.ReadLine());

switch (n)
{
case1:case2:case3:
Console.WriteLine("Poor");
break;

case4:case5:case6:
Console.WriteLine("Average");
break;

case7:case8:
Console.WriteLine("Good");
break;

case9:case10:
Console.WriteLine("Excellent");
break;

default:
Console.WriteLine("Invalid Grade");
break;
}
Console.ReadKey();
}
}


Answers (2)