Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace CSLight_4._2
- {
- class Program
- {
- static void Main(string[] args)
- {
- Console.WriteLine(ReadInt());
- }
- static int ReadInt()
- {
- string input;
- bool result;
- int number = 0;
- Console.Write("Введите целое число: ");
- while(true)
- {
- input = Console.ReadLine();
- result = int.TryParse(input, out number);
- if (result)
- {
- Console.Write("Число сконвертировано: ");
- break;
- }
- else
- {
- Console.WriteLine("Введенное число неверно! Повторите попытку");
- }
- }
- return number;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement