Skip to content

Instantly share code, notes, and snippets.

@Strelok78
Created May 11, 2025 09:21
Show Gist options
  • Save Strelok78/756fee08ebf0e7a2dcbcd848347215c2 to your computer and use it in GitHub Desktop.
Save Strelok78/756fee08ebf0e7a2dcbcd848347215c2 to your computer and use it in GitHub Desktop.
Read Int
namespace iJuniorPractice
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine(ReadInt());
}
static int ReadInt()
{
string input;
int result;
Console.WriteLine("Enter your number: ");
input = Console.ReadLine();
while (int.TryParse(input, out result) == false)
{
Console.WriteLine("Incorrect input, enter number...");
input = Console.ReadLine();
}
return result;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment