VOOZH about

URL: https://www.geeksforgeeks.org/php/find-root-of-quadratic-equation-using-php/

⇱ Find Root of Quadratic Equation using PHP - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

Find Root of Quadratic Equation using PHP

Last Updated : 17 Jan, 2024

A quadratic equation is a second-degree polynomial equation in a single variable, represented as ax^2 + bx + c = 0, where a, b, and c are constants. Solving a quadratic equation involves finding the values of the variable x that satisfy the equation. In this article, we will explore different approaches to finding the roots of quadratic equations in PHP.

Using Quadratic Formula

The quadratic formula is a standard method for solving quadratic equations.

We can implement this formula in PHP to find the roots of a quadratic equation.


Output
Roots: 2, 1

Using Factoring

Factoring involves expressing the quadratic equation as the product of two linear factors. We can use this method for simple cases where factoring is straightforward.


Output
Roots: 2, 1
Comment
Article Tags: