Loe ka numbreid

This commit is contained in:
Arti Zirk 2016-08-29 14:39:33 +03:00
parent 2b544d3030
commit a8c0abb420
1 changed files with 17 additions and 0 deletions

View File

@ -14,6 +14,23 @@ namespace KonsooliDemo
Console.Write("Mis on sinu nimi? ");
var consoleKeyInfo = Console.ReadLine();
Console.WriteLine("Tere {0}", consoleKeyInfo);
Console.Write("Sisesta number: ");
var strNumber = Console.ReadLine();
try
{
int number = int.Parse(strNumber);
Console.WriteLine(number);
}
catch (FormatException)
{
Console.WriteLine("See ei olnud number");
}
Console.Write("Vajuta mõnda klahvi lõpetamiseks");
Console.ReadKey();
}
}