      PROGRAM DICE
************************************************************************
* This program uses a random number generator to simulate rolling a    *
* pair of dice several times, counting the number of times a specified *
* number of spots occurs.  Identifiers used are:                       *
*    SPOTS  : number of spots to be counted                            *
*    COUNT  : number of times SPOTS occurred                           *
*    NROLLS : number of rolls of dice                                  *
*    R1, R2 : two random real numbers in the range 0 to 1              *
*    DIE1,                                                             *
*    DIE2   : number of spots on die #1, #2, respectively              *
*    PAIR   : sum of DIE1 and DIE2 = total # of spots on the dice      *
*    ROLL   : counts dice rolls                                        *
*    RESPON : user response                                            *
*    RANDOM : random number generator (subroutine)                     *
*                                                                      *
* Input:  NROLLS, SPOTS, RESPON, seed for random number generator      *
* Output: User prompts, and the relative frequency of the number of    *
*         spots                                                        *
************************************************************************

      INTEGER SPOTS, COUNT, NROLLS, DIE1, DIE2, PAIR, ROLL
      REAL R1, R2
      CHARACTER*1 RESPON

      PRINT *, 'ENTER NUMBER OF TIMES TO ROLL THE DICE:'
      READ *, NROLLS
      PRINT *, 'ENTER REAL NUMBER SEED FOR THE RANDOM NUMBER GENERATOR:'
      READ *, R1

*23456789012345678901234567890123456789012345678901234567890123456789012
* Begin the simulation
  9   FORMAT (7X, A, I1, A, I1, A)
 10   CONTINUE
         PRINT *, 'ENTER THE PAIR VALUE OF SPOTS TO COUNT (2-12):'
         READ *, SPOTS
         COUNT = 0
         DO 20 ROLL = 1, NROLLS
            CALL RANDOM(R1)
            CALL RANDOM(R2)
            DIE1 = 1 + INT(6*R1)
            DIE2 = 1 + INT(6*R2)
            PRINT 9, '(', DIE1, ', ', DIE2, ')'
            PAIR = DIE1 + DIE2
            IF (PAIR .EQ. SPOTS) COUNT = COUNT + 1
 20      CONTINUE

         IF (SPOTS .GE. 10) THEN
            PRINT 30, SPOTS,  100 * REAL(COUNT) / REAL(NROLLS)
 30         FORMAT (1X, 'THE RELATIVE FREQUENCY OF ROLLING ', I2,
     +          ' WAS', F