try
{
Console.WriteLine("Please Enter your Number");
string input = Console.ReadLine();
for (int i =0; i< input.Length;i++)
{
//int IntNum = Convert.ToInt32(input);
//int IntNum=input[i] - '0';
int IntNum = Convert.ToInt32(input[i].ToString());
if (IntNum % 2 == 0)
{
Console.ForegroundColor = ConsoleColor.Blue;
Console.WriteLine($"This '{IntNum}' Number is Even (Zoj)");
}
else
{
Console.ForegroundColor = ConsoleColor.Yellow;
Console.WriteLine($"This '{IntNum}' Number is Odd (Fard)");
}
}
}
catch
{
Console.ForegroundColor = ConsoleColor.Magenta;
Console.WriteLine("You are not Allowed to enter Text, Only Number");
}
Console.ResetColor();
Console.ReadKey();