//source code for usin switch statement
using System;
class SwitchDemo
{
static void Main()
{
Console.Write("Enter student no.(1-3): ");
int sno = int.Parse(Console.ReadLine());
switch(sno)
{
case 1:
Console.WriteLine("Student 1");
break;
case 2:
Console.WriteLine("Student 2");
break;
case 3:
Console.WriteLine("Student 3");
break;
default:
Console.WriteLine("Wrong student no.");
break;
}
}
}
No comments:
Post a Comment