You can use the console.ReadLine()method to read a value an integer from the keyboard, but console.ReadLine() method returns String value.Therefore, if you want to read an integer value , you need to convert the value returned by console.ReadLine() into an integer value.
Syntax:
int value=convert.ToInt32(console.ReadLine());
using System;
using System.Collections.Generic;
using System.Text;
namespace ConsoleApplication4
{
class Program
{
public void f1()
{
int score;
System.Console.WriteLine("Enter the Score");
score = Convert.ToInt32(Console.ReadLine()); // convert here intger value
switch (score)
{
case 100:
Console.WriteLine("Century");
break;
case 200:
Console.WriteLine("Double Century");
break;
default:
Console.WriteLine("Invalid case");
}
}
static void Main(string[] args)
{
Program pro = new Program();
pro.f1();
Console.ReadLine();
}
}
}