问答题
编号:2483005
给定程序MODI1.C中函数fun的功能是:计算n!。例如,给n输入入5,则输出l20.000000。
请改正程序中的错误,使程序能输出正确的结果。
注意:不要改动main函数,不得增行或删行,也不得更改程序的结构。
/**********code.c**********/
#include <stdio.h>
double fun ( int n )
{
double result = 1.0 ;
/**********found**********/
if n = = 0
return 1.0 ;
while( n >1 && n < 170 )
/**********found**********/
result *= n--
return result ;
}
void main ( )
{
int n ;
printf("Input N:") ;
scanf("%d", &n) ;
printf(" %d! =%lf ", n, fun(n)) ;
}
/**********-code.c**********/