【C語言】用公式求π的近似值,要求最後一項的絕對值不小於10的-6次方

手機用戶:   代碼:  #include <stdio.h> #include <math.h> int main() { float s = 1,pi = 0,i = 1.0,n=1.0;//s 是項數,pi是π,i是當前項的值,n是分母 while(fabs(i) >= 1e-6){//最後一項的絕對值不小於1e-6 pi += i; n
相關文章
相關標籤/搜索