#include <stdio.h>
#include <math.h>
 
int main(void) {
	//Let the quadratic equation be ax^2 + bx + c = 0
	float a,b,c,root1,root2,discriminant;
	printf("Enter coefficients a, b and c: ");
	scanf("%f %f %f", &a, &b, &c);
 
	discriminant = b*b - a*c*4;
	root1 = (-b + sqrt(discriminant)) / (2*a);
	root2 = (-b - sqrt(discriminant)) / (2*a);
	printf("Discriminant = %f\n", discriminant);
	if (discriminant > 0)
	{
		printf("Roots are real and distinct.\n");
		printf("Root 1 = %f\n", root1);
		printf("Root 2 = %f\n", root2);
	}
	else if (discriminant == 0)
	{
		printf("Roots are real and equal.\n");
		printf("Root 1 = Root 2 = %f\n", root1);
	}
	else
	{
		printf("Roots are complex.\n");
	}
	
	return 0;
}
 