Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace ConsoleApp
- {
- class Program
- {
- static void Main(string[] args)
- {
- ReadInt();
- }
- static void ReadInt()
- {
- bool isWork = true;
- int number = 0;
- Console.WriteLine($"Введите любое число.");
- while (isWork)
- {
- string userInput = Console.ReadLine();
- bool isConversionSuccessful = int.TryParse(userInput, out number);
- if (isConversionSuccessful)
- {
- Console.WriteLine($"Все случилось, '{userInput}' это число {number}");
- }
- else
- {
- Console.WriteLine("Введите еще раз:");
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement