      PROGRAM CODER
************************************************************************
* This program scrambles a message by converting each character of the *
* message to its numeric code, adding an integer to this code, and     *
* then converting the resulting number back to a character.  Variables *
* used are the following:                                              *
*     MESS    : message to be scrambled                                *
*     KEY     : integer to be added in scrambling the message          *
*     SYMBOL  : an individual character of the message                 *
*     CODE    : numeric code for SYMBOL                                *
*     I       : counter                                                *
*                                                                      *
* Input:  MESS and KEY                                                 *
* Output: User prompts and MESS (coded)                                *
************************************************************************

      CHARACTER*80 MESS, SYMBOL*1
      INTEGER KEY, I, CODE

      PRINT *, 'ENTER MESSAGE (END WITH #):'
      READ '(A)', MESS
      PRINT *, 'ENTER KEY:'
      READ *, KEY
      I = 1
      SYMBOL = MESS(1:1)

* While not end of string do

10    IF (I .LT. LEN(MESS) .AND. SYMBOL .NE. '#') THEN
          CODE = MOD(ICHAR(SYMBOL) + KEY, 256)
          MESS(I:I) = CHAR(CODE)
          I = I + 1
          SYMBOL = MESS(I:I)
          GO TO 10
      END IF

      PRINT *, 'CODED MESSAGE:'
      PRINT *, MESS
      END
