Benjail

4.3

Sep 2nd, 2019
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.66 KB | None | 0 0
  1. using System;
  2.  
  3. namespace Readline
  4. {
  5.     class Program
  6.     {
  7.         static void ReadInt()
  8.         {
  9.             bool open = true;
  10.             while (open==true)
  11.             {
  12.             Console.Write("Введите строку для перевода в int: ");
  13.             string stroka = Console.ReadLine();
  14.             int res;
  15.             bool stgnum = Int32.TryParse(stroka,out res);
  16.             if(stgnum==true)
  17.                 {
  18.                     Console.WriteLine(res);
  19.                     open = false;
  20.                 }
  21.             }
  22.         }
  23.         static void Main(string[] args)
  24.         {
  25.             ReadInt();
  26.         }
  27.     }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment