      program halfad
* Implements the electronic half-adder.
* Inputs A,B 
* Outputs Sum, Carry
*
      LOGICAL A,B,SUM,CARRY
      WRITE(*,*)'Enter Values for A, B  (Logical)'
      READ(*,*)A,B
* Calculate CARRY
      CARRY = A .AND. B
* Calculate  SUM
      SUM = (A .OR. B) .AND. (.NOT. CARRY)
* Print the results
      WRITE(*,*) 'For A = ',A,'  and  B = ',B
      WRITE(*,*) 'SUM  =  ',SUM, '   CARRY = ',CARRY
      END
