【无标题】

【无标题】,第1张

【无标题】

π/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;
}

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/zaji/5713828.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-12-18
下一篇 2022-12-17

发表评论

登录后才能评论

评论列表(0条)

保存