文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>C语言实例15:do-while语句

C语言实例15:do-while语句

时间:2010-06-20  来源:hnrainll

#include <stdio.h>
#include <math.h>
#include <stdlib.h>
int main(int argc, char *argv[])
{
    double s, t, x;
    int n;
    printf("please input x:");
    scanf("%lf", &x);

    t = x;
    n = 1;
    s = x;

    do
    {
        n = n + 2;
        t = t * (-x*x)/((float)(n) - 1)/(float)(n);
        s = s + t;
    }
    while(fabs(t) >= 1e-8);
    printf("sin(%f) = %lf\n", x , s);

    system("pause");
    return 0;


}


相关阅读 更多 +
排行榜 更多 +
别惹神枪手安卓版

别惹神枪手安卓版

冒险解谜 下载
坦克战争世界

坦克战争世界

模拟经营 下载
丛林反击战

丛林反击战

飞行射击 下载