数字个数
int[] nums = new int[10];
int[] count = new int[4];
Console.WriteLine("请输入数字");
for (int i = 0; i < nums.Length; i++)
{
Console.Write("请输入第{0}个数字:", i + 1);
nums[i] = Convert.ToInt32(Console.ReadLine());
if (nums[i] == 1)
{
count [0] ++ ;
}
else if (nums[i] == 2)
{
count[1]++;
}
else if (nums[i] == 3)
{
count[2]++;
}
else
{
count[3]++;
}
}
Console.WriteLine("数字1的个数{0}, count[0],);
Console.WriteLine("数字2的个数{0}, count[1],);
Console.WriteLine("数字3的个数{0}, count[2],);
Console.WriteLine("非法数字的个数{0}, count[3],);
Console.ReadKey();