在编译软件里运行输出没问题,结果均正确,但在pta提交没分,编译器输出也没有看懂,测试点也没看懂,然后就不知道咋办了,改了好几次,然后就以不同的理由没分
改动处见注释,供参考:
#include <stdio.h>
double fact(int n)
{
int i; // j
double t; //修改
for (i = 1, t = 1; i <= n; i++)
t *= i;
return t;
}
int main()
{
int m, n, ret;
double result; // 修改
ret = scanf("%d%d", &m, &n);
if (ret == 2) { // 修改
result = fact(n) / (fact(m) * fact(n - m));
printf("result = %.0f", result); //修改
}
return 0;
}
j要定义为double类型啊
result也要用double型。输出用%.0f,等号左右加空格