编程求ax2+bx+c=0方程的根,要求a,b,c从键盘入手,程序中求出方程的所有解

#include "stdio.h"
#include "math.h"

void main()

{

float a;
float b;
float c;
//定义一元二次方程3个系数

float x1, x2;
//存一元二次方程的解

float delta ;

//存一元二次方程的判根式

/*从用户处获取内输入*/
printf("分别输容入3个系数:\n");
scanf("%f%f%f", &a, &b, &c );
delta= b*b - 4*a*c;
printf("△=%f",delta);

if ( delta > 0 )
{
x1 = ( -b + sqrt(delta) ) / (2*a);
x2 = ( -b - sqrt(delta) ) / (2*a);

printf("此方程有两个不同解:\n" );
printf("x1 = %f, x2 = %f\n", x1, x2);

}

else if ( delta == 0)
{
x1 = (-b) / (2*a);
x2 = x1;

printf("此方程有一个解:\n");
printf("x1 = x2 = %f \n", x1);
}

else
{
printf("方程无解\n");
}

}