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