Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [StartCode]
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace ConsoleApp13
- {
- internal class Program
- {
- static void Main(string[] args)
- {
- GetNumber();
- }
- static void GetNumber()
- {
- bool isAttempt = true;
- while (isAttempt == true)
- {
- Console.Write("Введите число : ");
- string data = Console.ReadLine();
- int number;
- if (int.TryParse(data, out number))
- {
- Console.WriteLine(number);
- isAttempt = false;
- return ;
- }
- else
- {
- Console.WriteLine("Таких не бывает чисел .");
- }
- }
- }
- }
- }
- [EndCode]
Advertisement
Add Comment
Please, Sign In to add comment