using System;
namespace Test
{
class InputTest
{
static int Main()
{
int number;
Console.Write("Input a four-digit positive integer: ");
string line = Console.ReadLine();
if(!int.TryParse(line, out number) || number < 1000 || number > 9999)
{
Console.WriteLine("Bad input");
return 1;
}
Console.WriteLine((number / 1000) % 10);
Console.WriteLine((number / 100) % 10);
Console.WriteLine((number / 10) % 10);
Console.WriteLine(number % 10);
return 0;
}
}
}
Comments
Leave a comment