Coders Packet

Program to Find the Roots of a Quadratic Equation in C++

By Vidhu Shekhar Tripathi

This is a program where we find all the roots whether complex or real of a quadratic equation in C++.

Hello readers, now we will see the program to find complex or real roots of a quadratic equation in C++

This program firstly takes the 3 coefficients of the quadratic equation as inputs. Then the program calculates the discriminant based on the inputs given, let's say a,b and c. The discriminant is given by (b^2-4*a*c)/2*a. In reference to the value of the discriminant, the roots are called real or complex.

Then, along with real or complex roots, the program also finds the exact value of the roots.

Download Complete Code


No comments yet