标题:为什么结果会被四舍五入啊???
取消只看楼主
yy12
Rank: 1
等 级:新手上路
帖 子:3
专家分:0
注 册:2013-12-1
结帖率:0
已结贴  问题点数:10 回复次数:0 
为什么结果会被四舍五入啊???
#include<stdio.h>
#include<math.h>
int main()
{
    double i,flag,x;
    flag=1,x=0,i=1;
    while((1/i)>=pow(10,-6))
    {
        x=x+1/i;
        flag=(-1)*flag;
        i=(i+2)*flag;
    }
    printf("%.9f",4*x);
        
}
搜索更多相关主题的帖子: include double 
2013-12-02 12:34



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-424559-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 1.358644 second(s), 8 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved