吃饭睡觉写BUG 2017-12-02 03:01 采纳率: 20%
浏览 699

编程新手遇到问题啦啦啦求大佬帮助下

编译的时候显示错误是 id returned 1 exit status.

我的代码是:
#include
double fact(int n);

main()
{int m,n;
double result;
scanf("%d %d",&m,&n);
if(m>n)
printf("error!!");
else
{
result=fact(n)/(fact(m)*fact(n-m));
printf("result=%lf",result);

}

double fact(int n);
{ int i,s=1;
if(n!=1)
{for(i=1;i<=n;i++)
{s*=i;
}
return s;
}
}

}

  • 写回答

4条回答 默认 最新

  • threenewbee 2017-12-02 03:14
    关注

    result=fact(n)/(double)(fact(m)*fact(n-m));
    否则是整除

    评论

报告相同问题?