Advertisement
pol9na

Untitled

Mar 25th, 2020
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.85 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.             numberCheck();
  13.         }
  14.         static int numberCheck()
  15.         {
  16.             bool exit = true;
  17.             int number = 0;
  18.             while (exit == true)
  19.             {
  20.                 Console.WriteLine("Введите строку:");
  21.                 string input = Console.ReadLine();
  22.                 bool result = int.TryParse(input, out number);
  23.                 if (result == true)
  24.                 {
  25.                     Console.WriteLine("Преобразование прошло успешно");
  26.                     exit = false;
  27.                 }
  28.             }
  29.             return number;
  30.         }
  31.     }
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement