      PROGRAM HADDER
************************************************************************
* Program to calculate the outputs from a logical circuit that         *
* represents a binary half-adder.  Variables used are:                 *
*     A, B       : the two logical inputs to the circuit               *
*     SUM, CARRY : the two logical outputs                             *
*                                                                      *
* Input:   The two logical inputs A and B                              *
* Output:  The two logical outputs SUM and CARRY, which represent the  *
*          sum and carry that result when the input values are added   *
************************************************************************

      LOGICAL A, B, SUM, CARRY

      PRINT *, 'ENTER LOGICAL INPUTS A AND B:'
      READ *, A, B
      SUM = (A .OR. B) .AND. .NOT. (A .AND. B)
      CARRY = A .AND. B
      PRINT *, 'CARRY, SUM = ', CARRY, SUM

      END
