Loe ka numbreid
This commit is contained in:
parent
2b544d3030
commit
a8c0abb420
@ -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();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user