Answer:
#include <stdio.h>
#include <math.h>
int main()
{
float a,b,c;
printf("Enter the value of constants (a,b,c): ");
scanf("%f%f%f",&a,&b,&c);
float x1 = (-b+sqrt(pow(b,2)-4*a*c))/2*a;
float x2 = (-b-sqrt(pow(b,2)-4*a*c))/2*a;
printf("The root are x1 = %f and x2 = %f",x1,x2);
}
Explanation:
First include the library stdio.h for input/output and math.h for using the pow(), sqrt() function which is used o find the power and square root values.
pow(2,3) means 3 is the power of 2.
sqrt(4) means square root of 4.
create the main function and declare the variables.
after that, use the formula and calculate the root and store in the variables.
Finally, print the result on the screen.
NOTE: All variables is float but you can use the integer values as well.