using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
try{
Console.WriteLine("请输入10个数");
int[]nums=new int[10];
int[] counts = new int[4];
for(int i=0;i<nums.Length;i++)
{
Console.Write("请输入第{0}个数",i+1);
nums[i]=Convert.ToInt32(Console.ReadLine());
switch (nums[i])
{
case 1:
counts[0] += 1;
break;
case 2:
counts[1] += 1;
break;
case 3:
counts[2] += 1;
break;
default:
counts[3] += 1;
break;
}
}
Console.WriteLine("数字1的个数:{0}", counts[0]);
Console.WriteLine("数字2的个数:{0}", counts[1]);
Console.WriteLine("数字3的个数:{0}", counts[2]);
Console.WriteLine("非法数字的个数:{0}", counts[3]);
}
catch
{
Console.WriteLine("您输入的程序错误");
}
Console.ReadKey();
}
}
}