Solution of the Quadratic Equation by the program of C/C++

By | July 16, 2015

what is the Quadratic Equation. Its mathematical formula and the program with Algorithm.

hello friends today i will continue my programming articles.What is the Quadratic Equation, it definition and description. What is the mathematical formula of it.Program with Algorithm to solve the mathematical formula.

you may also like other main things in c++ language.

Quadratic Equation:

The Equation in which the maximum power of the variable in is only two. Then the equation is called Quadratic Equation. The Standard Equation of the Quadratic Equation is as follows…:

 

quadratic-equation[howpk.com]

quadratic-equation[howpk.com]

In which a,b,c is the constant and x is variable and 2 is the power that tells that, this is the Quadratic Equation.

quadratic-calculator[howpk]

quadratic-calculator[howpk]

Mathematical Formula:-

Mathematical Formula of Quadratic Equation is….. :

  • In which the Square-root in (+,-) show that their are two roots of

Quadratic Eq.

  • As we know that the number of roots is dependent of the

power the variable in the Equation.

Now i have to write the algorithm that is shown that how to create a formula of Quadratic Eqt in C/C++ Program?
which condition that we used in our program to solve the Quadratic formula by using C++ program (using of its constants.)

Algorithm:

Algorithm has two parts…
i. The first part is the paragraph in which we tell the purpose of our algo as well as all the name of variables that ara used in algo and we write the our Algo name in parentheses like as (Quadratic Formula).

There is no declaration of any variable in algo. we write it name in paragraph yet.
if we miss one and any variable name in paragraph and we use this variable in algo their was not problem because algorithm is the programical human language.

ii. The Second part is consist of the Steps that is used in algo. we use some notation that are use to write the algo are as follows….:

a)    Write/print is used for cout()                                                       b)    Read/Scan is used for cin()

c)    if   Condition then            [In the last of                                    d)   Repeat Step no. while   Condition
{ Step no.Statments…}            this Structure we                                   {   Step no.   Statements….}
[End of if Structure]                use this comment ]                                    [End of loop]                  

e)     set notation are use to assining or passing the any value in variable.

f) the algo is when the exit statement is executed and algo compilation is start from the 1st step of algo.

This algorithms use to solve the Quadratic Equation. This algorithm input the coefficients A, B, C of quadratic equation and output the real solutions, if any.

Step 1  # Read: A, B, C.

Step 2 # Set D := B2 – 4 AC.

Step 3 # If D > 0, Then

Step4 #  Set X1 := (-B + √D) / 2A

Step5 #       Set X2 := (-B – √D) / 2A

Step6 #Write : X1, X2

Step 7 #  Else If D = 0, Then

Step 8 #  Set X1 := (-B) / 2A

Step 9 # Write : X1

Srep 10 #  Else:

Step 11#    Write : ‘No real value solution’

[End of If structure]      //Comment in algo

Step 12 #  Exit.

i hope this this helpful to you.

 

Author: Awais Shafique

Hello My name is Awias.I am Student of BSCS in GCUF. I am the Senior Contributor of this website.