rendered paste body#include <stdio.h>
#include <math.h>
//This will solve quadratic equations. Whoop dee doo.
float A;
float B;
float C;
int main(void)
{
printf("This program will solve a given quadratic equation and \noutput the answer.\n");
printf("AX^2 + BX + C = 0\n");
printf("Input A: \n");
scanf("%f", &A);
printf("Input B: \n");
scanf("%f", &B);
printf("Input C: \n");
scanf("%f", &C);
if ((pow(B,2) - (4*A*C)) < 0)
{
printf("The answer is:\n");
printf("%f + %fi\nand\%f - %fi", (-B)/(2*A), sqrt(-1*(pow(B,2)-(4*A*C))), (-B)/(2*A), sqrt(-1*(pow(B,2)- (4*A*C))));
return 0;
}
else
{
printf("The answer is:\n");
printf("%f + %f\nand\%f - %f", (-B)/(2*A), sqrt(pow(B,2)-(4*A*C)), (-B)/(2*A), sqrt(pow(B,2)- (4*A*C)));
return 0;
}
}