Advertisement
Guest User

4.3

a guest
Oct 22nd, 2019
90
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.  
  7. namespace ConsoleApp1
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             int number;
  14.  
  15.             Console.WriteLine("Ожидаем ввод: ");
  16.  
  17.             while (true)
  18.             {
  19.                 string userInput = Console.ReadLine();
  20.                 if (int.TryParse(userInput, out number))
  21.                 {
  22.                     Console.WriteLine("Вы ввели число " + number);
  23.                     break;
  24.                 }
  25.                 else
  26.                 {
  27.                     Console.WriteLine("Вы ввели не число, введите еще раз");
  28.                 }    
  29.             }
  30.             Console.ReadLine();
  31.         }
  32.        
  33.     }
  34.            
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement