Advertisement
pol9na

Untitled

Mar 25th, 2020
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.86 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. namespace Study
  7. {
  8.     class Program
  9.     {
  10.         static void Main(string[] args)
  11.         {
  12.            
  13.             numberCheck();
  14.         }
  15.         static int numberCheck(int number = 0)
  16.         {
  17.            
  18.             bool exit = true;
  19.             while (exit == true)
  20.             {
  21.                 Console.WriteLine("Введите строку:");
  22.                 string input = Console.ReadLine();
  23.  
  24.                 bool result = int.TryParse(input, out number);
  25.                 if (result == true)
  26.                 {
  27.                     Console.WriteLine("Преобразование прошло успешно");
  28.                     exit = false;
  29.                 }
  30.             }
  31.             return number;
  32.         }
  33.     }
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement