/*********************************************************** vertex-quadratics.ch Quadratics This program calculates the vertex for a given quadratic of the form: y = ax^2 + bx + calculate ************************************************************ Copyright 2014 SoftIntegration Inc. http://www.softintegration.com Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 ***********************************************************/ //Initialize variables double a, b, c, h, k; //get a, b, c printf("ax^2 + bx + c\n"); printf("What is a? "); scanf("%lf", &a); printf("What is b? "); scanf("%lf", &b); printf("What is c? "); scanf("%lf", &c); //calculate using the vertex formula h = -1 * b / 2*a; k = (4*a*c - b*b)/(4*a); //display vertex printf("The vertex of %.3lfx^2 + %.3lfx + %.3lf is (%.3lf, %.3lf)\n", a, b, c, h, k);