Created
April 25, 2025 16:41
-
-
Save IvanVologda/516b377149a3c715caba5dab2af8a800 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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