      PROGRAM example                       ! beginning of main program
*     specify initial values and parameters
      IMPLICIT NONE
      REAL*8 delta_x, x, xmax, y
      CALL initial(y,x,delta_x,xmax)
      DO WHILE(x .LE. xmax)
         CALL Euler(y,x,delta_x)            ! use simple Euler algorithm
         WRITE(*,'(2F13.6)') x, y
      END DO
      END
C
      SUBROUTINE initial(y,x,delta_x,xmax)
      IMPLICIT NONE
      REAL*8 y, x, delta_x, xmax
      x = 1                                 ! initial value of x
      y = 1                                 ! initial value of y
      xmax = 2                              ! maximum value of x
      delta_x = 0.1D0                       ! step size
      WRITE(*,'(2A13)') ' x ', ' y '        ! print heading
      WRITE(*,*)                            ! skip line
      WRITE(*,'(2F13.6)') x, y              ! print initial values
      END
C
      SUBROUTINE Euler(y,x,delta_x)
*     variables slope and change introduced for sake of clarity only
      IMPLICIT NONE
      REAL*8 change, slope, y, x, delta_x
      slope = 2*x                           ! slope at beginning of interval
      change = slope*delta_x                ! estimate of change during interval
      y = y + change                        ! new value of y
      x = x + delta_x                       ! value of x at end of interval
      END
