Krishna Rajput Singh
How can you read an integer value from the keyword when the application is runtime?example?
By Krishna Rajput Singh in C# on Jul 16 2014
  • Rahul Prajapat
    Jun, 2015 1

    using Console.Readline()

    • 1
  • Pankaj  Kumar Choudhary
    Jun, 2015 1

    using Console.Readline()

    • 0
  • Piyush chhabra
    Apr, 2015 20

    We can also use int.Parse to conver string into integar. Example: String abc="500"; int num=int.Parse(abc); Console.writeline(num);It will also give output 500

    • 0
  • Krishna Rajput Singh
    Jul, 2014 16

    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 valueswitch (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();}} }

    • 0

Most Popular Job Functions


MOST LIKED QUESTIONS