static void Main(string[] args)
{
int temp = -1;
ListtempList=new List ();
do
{
int inp = Convert.ToInt32(Console.ReadLine());
if (inp!=0)
{
tempList.Add(inp);
}
temp = inp;
} while (temp != 0);
Console.WriteLine("偶数如下:");
foreach (var i in tempList.Where(o => o % 2 == 0))
{
Console.WriteLine(i);
}
Console.WriteLine("奇数如下:");
foreach (var i in tempList.Where(o => o % 2 != 0))
{
Console.WriteLine(i);
}
Console.ReadLine();
}
using System;
namespace domo
{
class Program
{
static void Main(string[] args)
{
int n, Odd = 0, Even = 0;
do
{
n = int.Parse(Console.ReadLine());
if (n % 2 == 1)
Odd += n;
else
Even += n;
} while (n != 0);
Console.WriteLine("奇数之和={0}", Odd);
Console.WriteLine("偶数之和={0}", Even);
}
}
}