Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace ConsoleApp1
- {
- class Program
- {
- static void Main(string[] args)
- {
- int convertResult = ConvertValue();
- Console.WriteLine($"Ваше значение {convertResult} успешно конвертировано");
- }
- static int ConvertValue()
- {
- bool convertTrue = false;
- string userValue;
- int convertResult = 0;
- while (!convertTrue)
- {
- Console.WriteLine("Введите значение");
- userValue = Console.ReadLine();
- convertTrue = int.TryParse(userValue, out convertResult);
- Console.Clear();
- }
- return convertResult;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement