请高手帮忙解决一个问题,本人菜鸟,急!!!!
从1到424的整数中,4出现的次数。(本人学C#的,请用C#语言来解决,谢谢!!!)
程序代码: static void Main(string[] args)
{
string s = null;
int count = 0;
for (int i = 0; i <= 424; i++)
{
s += i.ToString();
}
foreach (char c in s.ToCharArray())
{
if (c == '4')
{
count++;
}
}
Console.Write("count={0}", count);
Console.ReadKey();
}2,3,8的直接错误