用递归很方便;我简单的把函数给你写一下,主函数再用循环调用就行。 unsigned static int math(unsigned int n){ unsigned int s; if(n<=1) s=1; else s=n*math(n-1); return s;}