Advertisement
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 ConsoleApp13
- {
- class Program
- {
- static void Main(string[] args)
- {
- int y = readint();
- Console.WriteLine(y);
- Console.WriteLine();
- }
- static int readint()
- {
- string x;
- int num;
- while (true)
- {
- Console.WriteLine("Введите число");
- Console.WriteLine();
- x = Console.ReadLine();
- Console.WriteLine();
- bool a = Int32.TryParse(x, out num);
- if (a)
- {
- break;
- }
- else
- {
- Console.WriteLine("Должно быть число");
- Console.WriteLine();
- }
- }
- return (Convert.ToInt32(x));
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement