Formulas 2= vertex Quadratic Function: f(x)=x²+bx+c (h, k) -b± √b²-4ac 2a General form: f(x) = ax² +bx+c To get the vert
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am
Formulas 2= vertex Quadratic Function: f(x)=x²+bx+c (h, k) -b± √b²-4ac 2a General form: f(x) = ax² +bx+c To get the vert
Write a C program that works with a Quadratic Equation. Your program must ... • read in doubles a, b and c of a quadratic: f(x) = ax^2 + bx + c calculate and print the discriminant: b^2-4ac • calculate and print the vertex: (h, k) = (-b/2a, f(-b/2a)) • calculate and print the vertex form: f(x)= a(x-h)^2 + k read in an x integer from the user and evaluate the function at that x value: f(x) . ● • print to 2 decimals . loop until the user wants to quit .
Sample Test Case for entering a = 3, b=4 and c = -8. Your variable values and names may differ. discriminant = 112 Print as "Discriminant = 112" printf("Discriminant = %.2lf \n", discrim); vertex x = -0.67 and y = -12 Print as "Vertex = (-0.67, -9.333)" printf("Vertex = (%.2lf, %.2lf) \n", xVertex, yVertex); User enters x = 2 then f(2)= 12 Print as "f(2)= 12" printf("f( %.2lf) = %.2lf \n", x, fValAtX);