Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace ConsoleApp30
- {
- internal class Program
- {
- static void Main(string[] args)
- {
- int number;
- number = CheckNumber();
- Console.WriteLine(number);
- }
- static int CheckNumber()
- {
- bool isWork = true;
- int transformationInput = 0;
- while (isWork)
- {
- Console.WriteLine("Укажите число :");
- string userInput = Console.ReadLine();
- if (int.TryParse(userInput, out int number) == true)
- {
- transformationInput = number;
- Console.WriteLine("Корректно.");
- isWork = false;
- }
- else
- {
- Console.WriteLine("Ввод не число.");
- }
- }
- return transformationInput;
- }
- }
- }
Add Comment
Please, Sign In to add comment