Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace inputNum
- {
- class Program
- {
- static void Main(string[] args)
- {
- getMnumber();
- }
- static int getMnumber()
- {
- string userInput;
- int num;
- bool inputIsNum = false;
- while (true)
- {
- Console.WriteLine("Введите цело число: ");
- userInput = Console.ReadLine();
- inputIsNum = int.TryParse(userInput, out num);
- if (inputIsNum == true) break;
- Console.WriteLine("Не удалось распознать число.");
- };
- return num;
- }
- }
- }
Add Comment
Please, Sign In to add comment