C语言为什么输出一直是-0.00
#include<stdio.h>#include<math.h>intmain(){floata,b,c,x1,x2;scanf("a=%f",&a);scanf("b...
#include <stdio.h>
#include <math.h>
int main()
{
float a,b,c,x1,x2;
scanf ("a=%f",&a);
scanf ("b=%f",&b);
scanf ("c=%f",&c);
x1=(-b+sqrt((b*b)-(4*a*c)))/(2*a);
x2=(-b-sqrt((b*b)-(4*a*c)))/(2*a);
printf ("x1=%.2f\n",x1);
printf ("x2=%.2f\n",x2);
return 0
} 展开
#include <math.h>
int main()
{
float a,b,c,x1,x2;
scanf ("a=%f",&a);
scanf ("b=%f",&b);
scanf ("c=%f",&c);
x1=(-b+sqrt((b*b)-(4*a*c)))/(2*a);
x2=(-b-sqrt((b*b)-(4*a*c)))/(2*a);
printf ("x1=%.2f\n",x1);
printf ("x2=%.2f\n",x2);
return 0
} 展开
1个回答
展开全部
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询