CSharp examples for Language Basics:Data Type
Try to parse user input
using static System.Console; class Program//from ww w . java 2s .co m { static void TimesTable(byte number) { WriteLine($"This is the {number} times table"); for (int row = 1; row <= 12; row++) { WriteLine($"{row} x {number} = {row * number}"); } } static void Main(string[] args) { Write("Enter a number between 0 and 255: "); if (byte.TryParse(ReadLine(), out byte number)) { TimesTable(number); } else { WriteLine("You did not enter a valid number!"); } } }