I am trying to build a small quadratic calculator in C, but I am getting the following result no matter what my input is....
Here is my code:
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int main(void) {
float a, b, c;
printf("Enter a:");
scanf("%f", &a);
printf("Enter b:");
scanf("%f", &b);
printf("Enter c:");
scanf("%f", &c);
float discriminant = sqrt(b*b - 4*a*c);
float root1 = (-b + discriminant) / (2*a);
float root2 = (-b - discriminant) / (2*a);
printf("Root 1: %f\n", root1);
printf("Root 2: %f\n", root2);
}