printf("x1=%5.2f\n",x1)中的5.
来源:学生作业帮助网 编辑:作业帮 时间:2024/09/05 16:11:16
x)+(+IP0U53JSҩ0|cY-z6IEg³7i.x|ڰi';V=|:Z#t϶{
t>ٱ~ <;; Eb
printf(x1=%5.2f
,x1)中的5.
printf(“x1=%8.4f,x2=%8.4f
”,x1,x2);给解释下什么意识!
printf(该一元二次方程有两个解,x1 = %f,x2 = %f
,x1,x2); 在引号后面为什么还要写一次x1,x2?
杭电2001.为什么是wrong answer?#include#includemain(){float x1,x2,y1,y2;while(scanf(%f %f %f %f,&x1,&x2,&y1,&y2)!=EOF){printf(%.2f,sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2)));putchar('
');}}
c++求二元一次方程的根#include#includevoid main(){printf( ★☆欢迎使用二元一次方程求根工具☆★
);float a,b,c,q,p,x1,x2;printf( ★请输入a,b,c的值★
);printf(a=);scanf(%f,&a);printf(b=);scanf(
不知道是哪里错了.错误error C2065:'printf' :undeclared identifier#include main() {float a,b,c,disc,x1,x2,p,q;scanf(a=%f,b=%f,c=%f,&a,.&b,&c);disc=b*b-4*a*c;p=-b/(2*a);q=sqrt(disc)/(2*a);x1=p+q;x2=p-q;printf(
x1=%5.2f
x2=%5.2f
,x1,x2
c语言编写一元2次方程.#include#includevoid main(){double a,b,c,x1,x2,d;scanf(%f,%f,%f,&a,&b,&c);d=b*b-4*a*c;x1=(-b+sqrt(d))/2;x2=(-b-sqrt(d))/2;if(d>0)printf(x1=%f,x2=%f
,x1,x2);if(d=0)printf(x1=x2=%f
,x1);if(d
C语言编一元二次方程出了点问题,int main(int argc,char *argv[]){int a,b,c,x1,x2;printf(Please input:a,b,c
);scanf(%f%f%f,&a,&b,&c);x1=b*b-4*a*c;if(x10){ x2=(-b+sqrt(x1))/(2*a);x1=(-b+sqrt(x1))/(2*a);printf(x1=%f
x2=%f,x1,x2); } el
#include #include main() { float a,b,c,x1,x2,d; scanf(%f %f %f
,&a,&b,&c); d=b*#include#includemain(){float a,b,c,x1,x2,d;scanf(%f %f %f
,&a,&b,&c);d=b*b-4*a*c;if(d>=0 )if(d==0 ){ x1=x2=-b/(2*a);printf(x1=x2=%f
,x1);}else{ x1=(-b+sqrt(d))/(2
我的程序哪里出错啦?用函数求一元二次方程的根#include#includefloat yishigen(float m,float n,float k);{float m,n,k; float x1,x2; x1=(-n+sqrt(k))/(2*m);x2=(-n-sqrt(k))/(2*m);printf(two shigen is x1=%3f and x2=%3f
,x1,x2);}float d
求二次方程的解#includestdio.h#includemath.hvoid main(){float a,b,c,p,q,x1,x2;scanf(%f,%f,%f
,&a,&b,&c);p=sqrt(b*b-4*a*c)/2;q=-b/2;x1=p+q;x2=p-q;printf(x1=%1.1f,x2=%1.1f
,x1,x2);}
一段C语言程序,关于绝对值abs#include #include double fun(){double x0,x1;x1=0.0;do{x0=x1;x1=cos(x0);}while(fabs(x1-x0)>=1e-6);return x1;}main(){void NONO ( );printf(Root =%f
,fun());NONO();}这段程序的while(fabs(x1-x0)>=1e-6);语句,
杭电2001.运行结果是对的.为什么是wrong answer呢?#include#includemain(){float x1,x2,y1,y2;while(scanf(%f %f %f %f,&x1,&x2,&y1,&y2)!=EOF){printf(%.2f,sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2)));putchar('
');}}
用迭代法 求方程x=cosx得根,是误差小于10的负六.{double x1 x2;x1 = 0.0;x2 = cos(x1);while fabs(x2-x1) > (1e-6){ x1 = x2; x2 = cos(x1);}printf (x=%f
,x2);}求解题思路 我看不懂啊
帮我分析下C语言一元二次方程问题#includemain(){float a,b,c,p,x1,x2;scanf(%f%f%f,&a,&b,&c);p=sqrt(b*b-4*a*c);if(p>=0){{x1=(-b+p)/(2*a), x2=(-b-p)/(2*a);}printf(%f %f
,x1,x2);}else printf(wu jie
);}为什么我输入个2 5 8运
float f=123.456; printf(%10.2f,%-10.1f
,f,f);中的-10.1怎么解释
C语言中,关于求解一元二次方程解的问题#include#includevoid main(){float a,b,c,d,e,x1,x2;scanf(%f,%f,%f,a,b,c);printf(%fx^2+%fb+%f=0,a,b,c);d=b*b-4*a*c;e=sqrt(d);x1=(e-b)/2a;x2=(-e-b)/2a;printf(“方程的解为%f,%f
,x1,x2);}我
给我看看这个程序的问题,求一元二次方程的解#include #include{float a,b,c,d,x1,x2;scanf(%f,%f,%f,&a,%b,&c);d=b*b-4*a*cif(d==0){x1=(-b)/2*aprintf(x1=%f
,x1);}else if(d>0){x1=(-b)+sqrt(d)/2*a;x2=(-b)-sqrt(d)/2*a;printf(x1=%f,x2=%