Skip to content

Instantly share code, notes, and snippets.

@IvanVologda
Created April 25, 2025 16:41
Show Gist options
  • Save IvanVologda/516b377149a3c715caba5dab2af8a800 to your computer and use it in GitHub Desktop.
Save IvanVologda/516b377149a3c715caba5dab2af8a800 to your computer and use it in GitHub Desktop.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ДомашняяРабота28
{
internal class Program
{
static void Main(string[] args)
{
ConvertToInt();
}
private static void ConvertToInt()
{
bool isOpen = true;
while (isOpen)
{
Console.Write("Введите число: ");
string userInput = Console.ReadLine();
int number;
bool succses = int.TryParse(userInput, out number);
if (succses)
{
Console.WriteLine($"Вот твое число: {number}");
isOpen = false;
}
else
{
Console.WriteLine("Неверный ввод. Повторите попытку.");
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment