下面是源代码:#include "stdafx.h" #include<stdio.h> unsigned int factorial(unsigned int a); int _tmain(int argc, _TCHAR* argv[]) { unsigned int f,x; puts("Enter an interger value between 1 and 8:/n"); scanf("%d",&x); if(x>8||x<1) { printf("Error!/n"); } else { f=factorial(x); printf("%u factorial equals %u/n",x,f); } getchar(); return 0; } unsigned int factorial(unsigned int a) { if(a==1) return 1; else { a*=factorial(a-1); return a; } }