using System;
using System.Collections.Generic;
using System.Text;namespace TestC
{
class Program
{
static void Main(string[] args)
{
int i;
int j;
int m;
int n;
for (i = 0; i < 9;i++ )
{
for (j = 0; j < 9; j++)
{
for (m = 0; m < 9; m++)
{
for (n = 0; n < 9; n++)
{
Console.Write(i + j +m + n + " ");
}
}
}
}
}
}
}以上是我自己写的程序,怎么老是到32就截至了呢?(只要能正确输出0000--9999之间所有的数)
我认为题目也不难,怎么就运行不到俺心里呢?
请高手指点!谢谢
using System.Collections.Generic;
using System.Text;namespace TestC
{
class Program
{
static void Main(string[] args)
{
int i;
int j;
int m;
int n;
for (i = 0; i < 9;i++ )
{
for (j = 0; j < 9; j++)
{
for (m = 0; m < 9; m++)
{
for (n = 0; n < 9; n++)
{
Console.Write(i + j +m + n + " ");
}
}
}
}
}
}
}以上是我自己写的程序,怎么老是到32就截至了呢?(只要能正确输出0000--9999之间所有的数)
我认为题目也不难,怎么就运行不到俺心里呢?
请高手指点!谢谢
{
class Program
{
static void Main(string[] args)
{
int i, j, m, n;
for (i = 0; i <= 9; i++)
{
for (j = 0; j <= 9; j++)
{
for (m = 0; m <= 9; m++)
{
for (n = 0; n <= 9; n++)
{
Console.Write(i.ToString() + j.ToString() + m.ToString() + n.ToString() + " ");
}
}
}
}
}
}
}
{
Console.WriteLine(i.ToString("D4"));
}
经常看到有人把C#当C用...不知道是不是教C的老师太多了...
int j;
int m;
int n;
for (i = 0; i < 10; i++)
{
for (j = 0; j < 10; j++)
{
for (m = 0; m < 10; m++)
{
for (n = 0; n <10; n++)
{
Console.Write(" {0}{1}{2}{3}",i,j,m,n);
}
}
}
}这个可以了~~~ 我自己运行了!!