      PROGRAM CODER
************************************************************************
* This program encrypts a character string using the Caesar cipher     *
* seheme.  Variables used are the following:                           *
*     MESS    : message to be encrypted                                *
*     KEY     : integer to be added in encrypting 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, CODE, I

      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) - 32 + KEY), 95) + 32
         MESS(I:I) = CHAR(CODE)
         I = I + 1
         SYMBOL = MESS(I:I)
      GO TO 10
      END IF

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

      END
