main函数前面加一个函数声明
#include <stdio.h>#include <math.h>double f(double x);int main(){ double i = 1, s ; while (i <= 30) { s = pow((f(2 * i) / f(2 * i - 1)), 2) / (2 * i + 1); printf("第%.0f次计算π=%.20f\n", i, 2 * s); i++; } return 0;}double f(double x){ double s = 1; while (x > 0) { s = s*x; x = x - 2; } return(s);}