问答题

编写函数fun(),它的功能是;根据以下公式求p的值,结果由函数值带回。m与n为两个正数且要求m>n。 P=m!/n!(m-n)!),例如:m=12,n=8时,运行结果为495.000000。 注意:部分源程序给出如下。 请勿改动主函数main和其他函数中的任何内容,仅在函数fun的花括号中填入所编写的若干语句。 试题程序: #include <conio.h> #include <stdio.h> float fun (int m, int n) { } main() { clrscr() ; printf ("p=%f\n", fun (12,8) ) ; }

【参考答案】

float fun (int m, int n) { int i; double p=1.0; for(i=1;i......

(↓↓↓ 点击下方‘点击查看答案’看完整答案 ↓↓↓)
热门 试题