CSharp examples for Language Basics:Data Type Cast
Converting To Number (Of Entered Text)
using System;//from w ww.j a v a2s . c o m using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; class Program { static void Main(string[] args) { // Prompting the user Console.Write("How old are you? "); // Reading line of text string input = Console.ReadLine(); // Converting To Number (Of Entered Text) int enteredNumber = Convert.ToInt32(input); // Output of entered number Console.WriteLine("Your age: " + enteredNumber); } }