Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace CSLightFirst
- {
- class Program
- {
- static void Main()
- {
- while (true)
- TryParseUserInput();
- }
- private static void TryParseUserInput()
- {
- string userInput;
- int resultNumber;
- Console.Write("Введите целое число: ");
- userInput = Console.ReadLine();
- if (int.TryParse(userInput, out resultNumber))
- Console.WriteLine($"\nВаше число {resultNumber}\n");
- else
- Console.WriteLine("Число введено некорректно, попробуйте ещё раз\n");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement