代码如下,手机写的,自己调试下,如果没问题,请采纳,谢谢。
#include
#include
void main()
{
int nNum = 0;
int nResult = 0;
printf("Please input a number: ");
scanf("%d", &nNum);
for(;nNum > 0; nNum--)
{
nResult *= nNum;
}
printf("%d! = %d\n", nNum, nResult );
}