对楼上的改进。。。
static void Main(string[] args)
{
string str = Convert.ToString(Console.ReadLine());
int j = 0, o = 0;
foreach (string c in str.Split(','))//输入数据以逗号作为间隔,也可以用其他的
{
int i = Convert.ToInt32(c);
if (i % 2 == 0)
{
o++;
}
else
{
j++;
}
}
Console.WriteLine("偶数是:{0}个", o);
Console.WriteLine("奇数是:{0}个", j);
Console.ReadKey();
}