Advertisement
Vadim_Rogulev

Untitled

Apr 19th, 2019
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.82 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.  
  7. namespace ReadInt
  8. {
  9.     class Program
  10.     {
  11.         static int Main()
  12.         {
  13.             bool number = false;
  14.             int result = 0;
  15.  
  16.             while(!number)
  17.             {
  18.                 Console.Clear();
  19.                 Console.WriteLine("Введите число");
  20.                 number = int.TryParse(Console.ReadLine(), out result);
  21.                 if (!number)
  22.                 {
  23.                     Console.Clear();
  24.                     Console.WriteLine("Введено не число, Введите повторно");
  25.                     Console.ReadKey();
  26.                 }
  27.                
  28.             }
  29.             return result;
  30.            
  31.         }
  32.     }  
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement