Warning: fopen(/www/wwwroot/www.wendadaohang.com/data/md5_content_title/f0/f053065527c83ab495c1aeb2a0229291.txt): failed to open stream: No space left on device in /www/wwwroot/www.wendadaohang.com/inc/function.php on line 2468

Warning: flock() expects parameter 1 to be resource, bool given in /www/wwwroot/www.wendadaohang.com/inc/function.php on line 2469

Warning: fclose() expects parameter 1 to be resource, bool given in /www/wwwroot/www.wendadaohang.com/inc/function.php on line 2475
c语言程序计算10! - 66问答网

c语言程序计算10!

如题所述

第1个回答  2012-06-07
#include <stdio.h>

int main()
{
int n=1;
int i;
for(i=2;i<=10;i++)
n*=i;
printf("10! = %d\n",n);
}本回答被提问者采纳
第2个回答  2012-06-07
/* Note:Your choice is C IDE */
#include "stdio.h"
int f(int n){
long result;
if(n==0||n==1) result=1;
else
result=n*f(n-1);
return result;
}
void main()
{
int n=10;
printf("%d",f(n));
}
第3个回答  2012-06-07
#include <stdio.h>
void main()
{
long n=1;
int i;
for(i=2;i<=10;i++)
n*=i;
printf("10! = %ld\n",n);
}
第4个回答  2012-06-07
具体题目呢?追问

任意输入十个数保存到一维数组,请输出其中最大元素的值以及最大元素的下标