标题:这个我怎么也想不明白...高手的进来赐教
取消只看楼主
elite86
Rank: 1
等 级:新手上路
帖 子:17
专家分:0
注 册:2007-1-7
 问题点数:0 回复次数:1 
这个我怎么也想不明白...高手的进来赐教

昨天晚上看到的一道题目:
The factorial(阶乘) of an integer n,written n!,is the product of the consecutive integers 1 through n.For example,5 factorial is calculated as
5!=5*4*3*2*1=120
Write a program to generate and print a table of the first 10 factorials。

想了半天都没有结果,请高手指教。这个是我自己写的代码。
#include <stdio.h>

main()

{
int n,i;
long int s;
printf(" n________s\n");
for(n=1;n<=10;n++)
{
for (i=1;i<=n;i++)
{
s=i;
s=s*i;

printf(" %d %d\n",n,s);
}


}
return 0;
}

搜索更多相关主题的帖子: face generate example include product 
2007-01-09 12:44
elite86
Rank: 1
等 级:新手上路
帖 子:17
专家分:0
注 册:2007-1-7
得分:0 
谢谢大家,小弟明白了。

生活就像是编程,我得一步一步地来
2007-01-09 13:27



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-115044-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.015543 second(s), 8 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved