nynw.net
当前位置:首页 >> C语言编程: 编写一个程序,根据下列公式,实现根据... >>

C语言编程: 编写一个程序,根据下列公式,实现根据...

#include "stdio.h" int main(void) { int x; scanf("%d", &x); if (x > 100) printf("%d", x + 10); else if (x < -10) printf("%d", -x + 10); else printf("0"); return 0; }

#include int y(int x){ if(x < 0) return x * x - x +1; else return x * x * x + x -5;}int main(void){ int x; printf("Input x:"); scanf("%d", &x); printf("Y = %d\n", y(x)); return 0;}

#include#includeint main(){ double x, y; scanf ("%lf", &x); if (x > 0)y = sqrt(2*x); else if (x < 0)y = 1.0/(3*exp(x)); else y = 0; printf ("%.2f\n", y); return 0;}

#include //希望对您有用 #include int main() { int x, y; printf( "Please enter the number: " ); scanf( "%d", &x ); if( x

#include #include int help(int errno){const char *errstr[]={"Usage: Q Cd D Cp","Argument Cd error.","Argument D error.","Argument Cp error."};if (errno3) errno=0;else printf("%s", errstr[errno]);return errno;}int main(int argc,...

#include int main() { double fahr, celsius; //定义成double型比较好 while(scanf("%lf",&fahr)!=EOF) { celsius = 5*(fahr-32)/ 9.0; printf("%.2lf\n",celsius); //保留两位小数 } return 0; } 程序结束时按ctrl+z即可 有问题可以继续提

#include void main() { int i=1,j=1; float e=1.0,k; do{ j=i*j; k=1.0/j; e=e+k; i++; }while(k>1e-4);//判断误差是否小于给定的误差限E=0.0001 printf("%f\n",e); }

#include #include int main ( ) { double x,y; printf("input x:"); scanf("%lf",&x); if (x=10) y= sqrt( 3*x-4); else y=2*x*x-1; printf("y=%8.3f\n",y); return 0; }

#include void main(){ float x; printf("请输入x="); scanf("%f",&x); if(x

你写的程序实在看不清。不要拍照,要学会截图。 至于本题的程序,非常简单,给出程序代码如下: #include #include void main(){double i,x,k=1,s=1;scanf("%lf",&x);for(i=1;abs(k)>=1e-6;i++){k*=-x*x/((i*2-1)*i*2);s+=k;}printf("sum=%.2f",...

网站首页 | 网站地图
All rights reserved Powered by www.nynw.net
copyright ©right 2010-2021。
内容来自网络,如有侵犯请联系客服。zhit325@qq.com