The switch statement with a user input from keyboard
using System;
public class MainClass {
public static void Main( ) {
Console.WriteLine("Please make your selection");
Console.WriteLine("1 Hamburger");
Console.WriteLine("2 Cheese Burger");
Console.WriteLine("3 Fish");
int Selection = int.Parse( Console.ReadLine( ) );
switch( Selection ) {
case 1:
Console.WriteLine("Hamburger");
break;
case 2:
Console.WriteLine("Cheese Burger");
break;
case 3:
Console.WriteLine("Fish");
break;
default:
Console.WriteLine("Unknown choice");
break;
}
}
}
Output Please make your selection
1 Hamburger
2 Cheese Burger
3 Fish
1
Hamburger
|
HTML code for linking to this page:
Related in same category :
-
-
-
-
-
-
-
-
-
-
|