using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApplication3
{
class Program
{
static void Main(string[] args)
{
int[] numList = new int[] { 22, 444, 3, 5555, 6666 };
//4位数或小于4位数
int[] digit = new int[] { 0, 0, 0, 0 };
foreach (int num in numList)
{
int n = num.ToString().Length;
while (n > 0)
{
digit[n - 1] += 1;
--n;
}
}
Console.WriteLine("个位数{0},十位数{1},百位数{2},千位数{3}", digit[0],digit[1],digit[2],digit[3]);
Console.ReadLine();
}
}
}
温馨提示:答案为网友推荐,仅供参考