static void Main(string[] args)
{
int ge, shi, bai;
Console.WriteLine("所有水仙花数是:");
for (int i = 100; i <= 999; i++)
{
ge = i % 10;
shi = i / 10 % 10;
bai = i / 100;
if (ge * ge * ge + shi * shi * shi + bai * bai * bai == i)
Console.Write(" {0}", i);
}
Console.Read();
}
}
}
|