      PROGRAM ACCIRC
**********************************************************************
* Program to compute the current in an a-c circuit containing a      *
* capacitor, an inductor, and a resistor in series.   Variables      *
* used are:                                                          *
*    R     : resistance (ohms)                                       *
*    L     : inductance (henrys)                                     *
*    C     : capacitance (farads)                                    *
*    OMEGA : frequency (radians/second)                              *
*    V     : voltage (volts)                                         *
*    Z     : total impedance                                         *
*    I     : current (amperes)                                       *
*                                                                    *
* Input:  R, L, C, OMEGA, and V                                      *
* Output: I                                                          *
**********************************************************************

      REAL R, L, C, OMEGA
      COMPLEX V, Z, I

      PRINT *, 'ENTER RESISTANCE (OHMS), INDUCTANCE (HENRIES), ',
     +         ' AND CAPACITANCE (FARADS):'
      READ *, R, L, C

      PRINT *, 'ENTER FREQUENCY (RADIANS/SECOND):'
      READ *, OMEGA
      PRINT *, 'ENTER VOLTAGE AS A COMPLEX NUMBER IN THE FORM (X, Y):'
      READ *, V

* Calculate resistance using complex arithmetic
      Z = R +  OMEGA * L * (0.0, 1.0)  - (0.0, 1.0) / (OMEGA * C)

* Calculate and display current using complex arithmetic
      I = V / Z
      PRINT *
      PRINT 100, I, ABS(I)
100   FORMAT(1X, 'INSTANTANEOUS CURRENT = ', F10.4, ' + ',
     +       F10.4, 'I' / 1X, 'WITH MAGNITUDE = ', F10.4)

      END
