π/2=2/1*2/3*4/3*4/5*6/5*6/7*...
求π
#include#include int main() { double term,result = 1.0; int n; for(n = 2;n <= 100;n = n+2) { term = (double)(n*n) / ( (n-1)*(n+1) ); result = result * term; //printf("%fn",result); } printf("Pi = %fn",2 * result); return 0; }
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)