      PROGRAM COMPLX

      REAL*4 W(2),X(2),Y(2),Z(2)
      CHARACTER*20 A

900   FORMAT(1X,' ')
901   FORMAT(1X,'What is the complex X value? ')
902   FORMAT(1X,1X,F8.5,2X,F8.5)
903   FORMAT(1X,'What is the complex Y value? ')
904   FORMAT(1X,'What is the integer value?   ')
905   FORMAT(1X,1X,I5)
910   FORMAT(1X,20X,'COMPLEX FUNCTIONS TEST')
911   FORMAT(1X,'    X REAL',5X,'X COMPLEX',6X,'Y REAL',5X,'Y COMPLEX',
     16X,'N')
912   FORMAT(1X,2X,4(F9.5,4X),I3)
913   FORMAT(1X,A22,2(2X,F10.5))
914   FORMAT(1X,A22,2(2(2X,F10.5),3X))

      WRITE(*,900)
      WRITE(*,901)
      READ(*,902) X(1),X(2)
      WRITE(*,903)
      READ(*,902) Y(1),Y(2)
      WRITE(*,904)
      READ(*,905) N
      M = -N
      WRITE(*,900)
      WRITE(*,900)
      WRITE(*,900)
      WRITE(*,910)
      WRITE(*,900)
      WRITE(*,911)
      WRITE(*,912) X(1),X(2),Y(1),Y(2),N
      WRITE(*,900)

      A = 'X + Y =             '
      CALL FCADD(X,Y,Z)
      WRITE(*,913) A,Z(1),Z(2)

      A = 'X - Y =             '
      CALL FCSUB(X,Y,Z)
      WRITE(*,913) A,Z(1),Z(2)

      A = 'X * Y =             '
      CALL FCMUL(X,Y,Z)
      WRITE(*,913) A,Z(1),Z(2)

      A = 'X / Y =             '
      CALL FCDIV(X,Y,Z)
      WRITE(*,913) A,Z(1),Z(2)

      A = 'X TO THE N POWER =  '
      CALL FCNPR(N,X,Z)
      CALL FCNPR(M,X,W)
      WRITE(*,914) A,Z(1),Z(2),W(1),W(2)

      A = 'N ROOT OF X =       '
      CALL FCNRT(N,Z,Z)
      CALL FCNRT(M,W,W)
      WRITE(*,914) A,Z(1),Z(2),W(1),W(2)

      A = 'SQUARE ROOT OF X    '
      CALL FCSQR(X,Z)
      M = 2
      CALL FCNPR(M,Z,W)
      WRITE(*,914) A,Z(1),Z(2),W(1),W(2)

      A = 'E TO THE X POWER =  '
      CALL FCEXP(X,Z)
      CALL FCLN(Z,W)
      WRITE(*,914) A,Z(1),Z(2),W(1),W(2)

      A = 'E TO THE -X POWER = '
      W(1) = -X(1)
      W(2) = -X(2)
      CALL FCEXP(W,Z)
      CALL FCLN(Z,W)
      WRITE(*,914) A,Z(1),Z(2),-W(1),-W(2)

      A = 'COMPLEX LN(X) =     '
      CALL FCLN(X,Z)
      CALL FCEXP(Z,W)
      WRITE(*,914) A,Z(1),Z(2),W(1),W(2)

      A = 'LOG OF X BASE Y =   '
      CALL FCLGY(X,Y,Z)
      CALL FCYX(Z,Y,W)
      WRITE(*,914) A,Z(1),Z(2),W(1),W(2)

      A = 'Y TO THE X POWER =  '
      CALL FCYX(X,Y,Z)
      CALL FCLGY(Z,Y,W)
      WRITE(*,914) A,Z(1),Z(2),W(1),W(2)

      A = 'COMPLEX SIN(X) =    '
      CALL FCSIN(X,Z)
      CALL FCASN(Z,W)
      WRITE(*,914) A,Z(1),Z(2),W(1),W(2)

      A = 'COMPLEX COS(X) =    '
      CALL FCCOS(X,Z)
      CALL FCACS(Z,W)
      WRITE(*,914) A,Z(1),Z(2),W(1),W(2)

      A = 'COMPLEX TAN(X) =    '
      CALL FCTAN(X,Z)
      CALL FCATN(Z,W)
      WRITE(*,914) A,Z(1),Z(2),W(1),W(2)

      A = 'COMPLEX ARCSIN(X) = '
      CALL FCASN(X,Z)
      CALL FCSIN(Z,W)
      WRITE(*,914) A,Z(1),Z(2),W(1),W(2)

      A = 'COMPLEX ARCCOS(X) = '
      CALL FCACS(X,Z)
      CALL FCCOS(Z,W)
      WRITE(*,914) A,Z(1),Z(2),W(1),W(2)

      A = 'COMPLEX ARCTAN(X) = '
      CALL FCATN(X,Z)
      CALL FCTAN(Z,W)
      WRITE(*,914) A,Z(1),Z(2),W(1),W(2)

      END
