求n的阶层

2015-09-14 22:26:56 -0400
#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;
}
int main(void) {
int n;
printf("Input N:");
scanf("%d", &n);
printf("\n\n%d! =%lf\n\n", n, fun(n));
}
«Newer      Older»
Comment:
Name:

Back to home

Subscribe | Register | Login | N