In this code to solve quadratic equation using simple program with explanation of each step in program using necessary comments.

**factoring the quadratic equation**and second is using

**quadratic equation formula**

Factoring method not suitable all time because of the in factoring method some quadratic equation too messy and doesn’t factor.

So the most preferable method to solve quadratic equation is quadratic equation formula.

Quadratic equation formula is as shown in figure.

In this formula square root part is decide the solution of quadratic equation, means that the if the **(xCofficient) ^{2}-4*xSqureCofficient*constant **is equal to zero this means that the roots of quadratic equation is real and both are equal and root can calculate using

**-xCofficient/(2.0*xSqureCofficient)**

and if discriminant is greater then the zero this means that the roots of quadratic equation is real and both are distinct and both root can calculate using first root is ((-xCofficient+sqrt((xCofficient*xCofficient)-(4.0*xSqureCofficient*constant)))

/(2.0*xSqureCofficient))

second root is

((-xCofficient-sqrt((xCofficient*xCofficient)-(4.0*xSqureCofficient*constant)))

/(2.0*xSqureCofficient))

**Code**

/* Programed by:- bharat kumar dhaker Website-www.computersciencearticle.in */ #include<stdio.h> #include<conio.h> #include<stdlib.h> #include<math.h> //math.h for calcualte the squre root of xCofficient void main() { clrscr(); double xFirst, xSecond, Discriminant; int xSqureCofficient, xCofficient,constant; printf("enter the value of Quadratic Equation xSqureCofficient, xCofficient,constantn"); scanf("%d",&xSqureCofficient); scanf("%d",&xCofficient); scanf("%d",&constant); /* next line calculate the discriminant of quadratic equation square of xCofficient-4*xSqureCofficient*constant */ Discriminant=(xCofficient*xCofficient)-(4*xSqureCofficient*constant); /* If the discriminant is equal to zero this means that the roots of quadratic equation is real and both are equal */ if(Discriminant==0) { printf("Quadratic Equation roots are real and both equal, which is asn"); xFirst=xSecond=-xCofficient/(2.0*xSqureCofficient); printf("First root=%f , Second root=%f",xFirst,xSecond); } /* If the discriminant is greater then the zero this means that the roots of quadratic equation is real and both are distinct */ else if(Discriminant>0) { xFirst= ((-xCofficient sqrt((xCofficient*xCofficient)- (4.0*xSqureCofficient*constant))) /(2.0*xSqureCofficient)); xSecond=((-xCofficient-sqrt((xCofficient*xCofficient)- (4.0*xSqureCofficient*constant))) /(2.0*xSqureCofficient)); printf("Quadratic Equation roots are real and unequal, which is asn"); printf("First root= %f , Second root=%f",xFirst,xSecond); } /* If the discriminant is less then zero or negative that is roots of quadratic equation is imaginary */ else { printf("Quadratic Equation roots are imaginary"); } getch(); }

Example:-

Lets take an example of quadratic equation

**3x ^{2} – 5x – 6 = 0**

In this quadratic equation find out each coefficient

xSqureCofficient=3

xCofficient= -5

Constant= -6

enter these values in program above then the following output is generated

that is roots of given quadratic equation is

First root = 2.474810

Second root= -0.808143

I believe this is one of the most significant information for me. And i am happy studying your article. the articles is in reality nice : D. Just right activity, cheers