Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace CSLight
- {
- internal class Program
- {
- static void Main(string[] args)
- {
- Console.WriteLine(TryToConvert());
- Console.ReadKey();
- }
- private static int TryToConvert()
- {
- bool isConverted = false;
- int number = 0;
- while (isConverted == false)
- {
- Console.WriteLine("Введите число");
- string uerInput = Console.ReadLine();
- if (int.TryParse(uerInput, out number))
- {
- isConverted = true;
- }
- else
- {
- Console.WriteLine("Не удалось конвертировать, попробуйте еще раз.");
- }
- }
- return number;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement