精品偷拍一区二区三区,亚洲精品永久 码,亚洲综合日韩精品欧美国产,亚洲国产日韩a在线亚洲

  • <center id="usuqs"></center>
  • 
    
  • 利用泰勒級數(shù)sin(x)=x-x^3/3!+x^5/5!-x^7/7!...,計算sinx的值,要求最后一項的值小于10^(-5)

    利用泰勒級數(shù)sin(x)=x-x^3/3!+x^5/5!-x^7/7!...,計算sinx的值,要求最后一項的值小于10^(-5)
    下面是我寫的c程序,請問錯在哪?
    #include
    #include
    #include
    double x,sinx =0,n =1,A =1; //A為(2n-1)!
    void main()
    {
    \x05scanf("%f",&x);
    \x05for(n=1;pow(x,2*n-1)/A > 0.00001; )
    \x05{
    \x05 sinx +=pow(-1,n-1)*pow(x,2*n-1)/A;
    \x05\x05 n++;
    \x05\x05 while (n>1 && A
    其他人氣:243 ℃時間:2020-02-06 04:34:05
    優(yōu)質(zhì)解答
    scanf("%f",&x); 這兒改成scanf("%lf",&x);
    x是double類型變量,scanf的格式是%lf
    輸出的時候也一樣
    #include <stdio.h>
    #include <math.h>
    #include <stdlib.h>

    double x,sinx =0,n =1,A =1;  //A為(2n-1)!

    void main()
    {
    scanf("%lf",&x); 
    for(n=1;pow(x,2*n-1)/A > 0.00001; )
    {              
         sinx +=pow(-1,n-1)*pow(x,2*n-1)/A;
     n++;
     A=A*(2*n-2)*(2*n-1);
    }
    printf("%lf %lf\n",sinx,n);
    system("pause");            
    }

    程序改了,你再看看

    我來回答
    類似推薦
    請使用1024x768 IE6.0或更高版本瀏覽器瀏覽本站點,以保證最佳閱讀效果。本頁提供作業(yè)小助手,一起搜作業(yè)以及作業(yè)好幫手最新版!
    版權(quán)所有 CopyRight © 2012-2024 作業(yè)小助手 All Rights Reserved. 手機版