int amount1 = default;
int amount2 = default;
string Nomer = "123123";
if(Nomer.Length != 6)
{
Console.WriteLine("Длина билета должна быть 6 символов!");
return;
}
for (int i = 0; i < 3; i++)
{
amount1 += Convert.ToInt32(Nomer[i].ToString());
}
for (int i = 3; i < 6; i++)
{
amount2 += Convert.ToInt32(Nomer[i].ToString());
}
if(amount1 == amount2)
{
Console.WriteLine("I got the lucky ticket!");
}
else
{
Console.WriteLine("Better luck next time");
}
string TicketNo = Console.ReadLine();
bool IsLucky = TicketNo.ToCharArray().Take(3).Select(x => int.Parse(x.ToString())).Sum() == TicketNo.ToCharArray().Skip(3).Select(x => int.Parse(x.ToString())).Sum();
Console.WriteLine(IsLucky? "Lucky": "Unlucky");