fac 函数中,你是想求阶乘吧?把 return 放到 for 循环之后,你在试试看
函数中的return sum放到for循环结束以后,不能放到for循环里main里的公式写错了p = fac(m)/((fac(m-k)*fac(k));