      PROGRAM QUAD4
************************************************************************
* Program to solve a quadratic equation using the quadratic formula.   *
* It uses an arithmetic IF statement to select the appropriate action  *
* depending on whether the discriminant DISC is negative, zero, or     *
* positive.  Variables used are:                                       *
*    A, B, C      : the coefficients of the quadratic equation         *
*    DISC         : the discriminant, B ** 2 - 4 * A * C               *
*    ROOT1, ROOT2 : the two roots of the equation                      *
*                                                                      *
* Input:  The coefficients A, B, and C                                 *
* Output: The two roots or the repeated root of the equation or the    *
*         (negative) discriminant and a message indicating that there  *
*         are no real roots                                            *
************************************************************************

      REAL A, B, C, DISC, ROOT1, ROOT2

      PRINT *, 'ENTER THE COEFFICIENTS OF THE QUADRATIC EQUATION'
      READ *, A, B, C
      DISC = B ** 2 - 4 * A * C
      IF (DISC) 10, 20, 30

* No real roots

10    PRINT *, 'DISCRIMINANT IS', DISC
      PRINT *, 'THERE ARE NO REAL ROOTS'
      STOP

* Repeated real root

20    ROOT1 = -B / (2 * A)
      PRINT *, 'REPEATED ROOT IS', ROOT1
      STOP

* Distinct real roots

30    DISC = SQRT(DISC)
      ROOT1 = (-B + DISC) / (2 * A)
      ROOT2 = (-B - DISC) / (2 * A)
      PRINT *, 'THE ROOTS ARE', ROOT1, ROOT2
      END
