c Program of the quadratic equation


write a c  program of An equation of the form  ax2 + bx + c = 0   is known as the quadratic equation.
The values of x that satisfy the equation are known as the roots of the equation.
A quadratic equation has two roots which are given by the following two formula

root1=-b+sqrt(b2 -4ac) /2a    

root2=-b-sqrt(b2 -4ac) /2a

a quadratic equation, depending on  whether the expression inside the square root  sign, (b2 – 4ac) , is positive, negative, or  zero. This expression has a special name: the  discriminant.

 OUTPUT   of program  ax2 + bx + c = 0  , A quadratic equation.

discriminant is positive     if b2 -4ac > 0
then the quadratic equation has two solutions.

discriminant is zero          if   b2 – 4ac = 0
then the quadratic equation has one solution.

discriminant is negative   if b2 -4ac < 0
then the quadratic equation has no solutions.

C   program   run   First Time 

Input values of a, b, and c

2  4  -16

discriminant = 144.000000

Rootl = 2.00

Root2 = -4.00

C   program   run   Second  Time 

Input values of a, b, and c 1 2 3

discriminant = -8.000000

Roots are Imaginary

(Visited 86 times, 1 visits today)

Leave a Reply

Your email address will not be published. Required fields are marked *


CAPTCHA Image
Reload Image