帮忙指正c语言程序基础题!!
帮忙指正c语言程序基础题!!
日期:2007-09-15 10:12:07 人气:1
阶乘都是很大的数,即使设为long也只能算到12!,超过13会溢出,产生floating point error:domain
所以不要用函数jc。还有x为double,应用scanf("%ld",&x);
修改如下:
#include
double ceof(int n)
{
double cf=1; int i;
for(i=1;i<=n;++i) cf/=i;
if((n+1)%4==0) return -cf;
else return