Question

*use quadratic formula to solve quadratic equation. output the solutions with clear explanations * see how...

*use quadratic formula to solve quadratic equation. output the solutions with clear explanations
* see how the answers are close to zero when substitute them in the equation
*Plot the function in the range of [-D,E] ( from -7 to 3 in the example given
*Use of meaningful variable names
*Use an array instead of six different variables
*Use a for loop with the array
*Depending on the sign of the discriminant ?2 − 4?? is less than zero, output appropriate messages.
*Script file able to read in more than one IDs and process them accordingly. improving the accuracy when |4??| is much smaller than B2

Homework Answers

Answer #1

By seeing question it seems you need program to solve quadratic equation

so i am giving fortran program

PROGRAM  QuadraticEquation
   IMPLICIT  NONE

   REAL  :: a, b, c
   REAL  :: d
   REAL  :: root1, root2
   
!  read in the coefficients a, b and c

   READ(*,*)  a, b, c
   WRITE(*,*) 'a = ', a
   WRITE(*,*) 'b = ', b
   WRITE(*,*) 'c = ', c
   WRITE(*,*)

!  compute the square root of discriminant d

   d = b*b - 4.0*a*c
   IF (d >= 0.0) THEN              ! is it solvable?
      d     = SQRT(d)
      root1 = (-b + d)/(2.0*a)     ! first root
      root2 = (-b - d)/(2.0*a)     ! second root
      WRITE(*,*)  'Roots are ', root1, ' and ', root2
   ELSE                            ! complex roots
      WRITE(*,*)  'There is no real roots!'
      WRITE(*,*)  'Discriminant = ', d
   END IF

END PROGRAM  QuadraticEquation
Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions