      PROGRAM series_test
*     illustrate use of DO LOOP
      IMPLICIT NONE
      REAL*8 newterm, relative_change, sum
      INTEGER n
      sum = 0                               ! initialize variables
      n = 0
      relative_change = 1                   ! choose large value
      DO WHILE(relative_change .GT. 1.0D-4)
         n = n + 1
         newterm = 1.0D0/n/n
         sum = sum + newterm
         relative_change = newterm/sum
         WRITE(*,'(I13,2F13.6)') n, relative_change, sum
      END DO
      END
