关于C语言解一元二次方程的问题为啥b,c的值都为0呢#include "stdio.h"#include "math.h"int main(){double a,b,c;double delta,x1,x2;printf("Please input 3 real numbers for a,b,c\n");scanf("%lf%lf%lf",&a,&b,&c);printf("a=%f b=%f c=%
来源:学生作业帮助网 编辑:六六作业网 时间:2024/12/28 08:49:58
关于C语言解一元二次方程的问题为啥b,c的值都为0呢#include "stdio.h"#include "math.h"int main(){double a,b,c;double delta,x1,x2;printf("Please input 3 real numbers for a,b,c\n");scanf("%lf%lf%lf",&a,&b,&c);printf("a=%f b=%f c=%
关于C语言解一元二次方程的问题
为啥b,c的值都为0呢
#include "stdio.h"
#include "math.h"
int main()
{
double a,b,c;
double delta,x1,x2;
printf("Please input 3 real numbers for a,b,c\n");
scanf("%lf%lf%lf",&a,&b,&c);
printf("a=%f b=%f c=%f\n",a,b,c);
delta=b*b-4*a*c;
x1=(-b-sqrt(delta))/(2*a);
x2=(-b+sqrt(delta))/(2*a);
printf("x1=%fx2=%f\n",x1,x2);
return 0;
}
关于C语言解一元二次方程的问题为啥b,c的值都为0呢#include "stdio.h"#include "math.h"int main(){double a,b,c;double delta,x1,x2;printf("Please input 3 real numbers for a,b,c\n");scanf("%lf%lf%lf",&a,&b,&c);printf("a=%f b=%f c=%
TDM-GCC 64位元编译无误.