- 博客(2)
- 收藏
- 关注
原创 计算f的值,x由键盘输入 f(x)={|x+1| x<0;2x+1 0≤x≤5 sin x+5 x>5
#include<muth.h>main(){ float x,f=0; printf("从键盘输入一个数\n"); scanf("%f",&x); if(x<0) printf("=%f",abs(x+1)); else if(x<=5) printf("=%f",2*x+1); else pr...
2022-08-16 10:11:10 540
原创 用公式(π/4≈1-1/3+1/5-1/7+…)求 π 的近似值,直到最后一项绝对值小于10^-6
#include <stdio.h>main(){ int n=1,f=1; float s=0; while(1.0/n>0.000001){ s=s+1.0/n*f; n=n+2; f=f*-1;} printf("pai的值是:%f",4*s);}...
2022-08-16 09:51:37 3407
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人