输入一个整数n,输出n的阶乘
一个整数n(1<=n<=20)
3
6
#include <stdio.h> #include <string.h> #include <stdlib.h> int main() { int n,i; while(scanf("%d",&n) != EOF) { double count = 1; for(i = 1;i <= n;i++){ count *= i; } printf("%.0lf\n",count); } return 0; } /************************************************************** Problem: 1067 User: vhreal Language: C Result: Accepted Time:0 ms Memory:912 kb ****************************************************************/
原文地址:http://blog.csdn.net/wtyvhreal/article/details/42293587