title: Fortran's warning on a program for evaluating elliptic integrals
body: <p>On internet, I found this program that demonstrate Evaluating elliptic integrals of first and second kinds (complete)  </p>
  
  <pre><code>  implicit none
    real*8  e,e1,e2,xk
    integer i, n
  
      e=1.d-7
      print *,'  K         K(K)          E(K)      STEPS '
      print *,'------------------------------------------'
      xk=0.d0
      do i = 1, 20
      call CElliptic(e,xk,e1,e2,n)
      write(*,50)  xk,e1,e2,n
      xk = xk + 0.05d0
      end do
      print *,'1.00     INFINITY      1.0000000      0'
      stop
      50 format(' ',f4.2,'     ',f9.7,'     ',f9.7,'     ',i2)
     end
  </code></pre>
  
  <p>Complete elliptic integral of the first and second kind. The input parameter is xk, which should be between 0 and 1. Technique uses Gauss' formula for the arithmogeometrical mean. e is a measure of the convergence accuracy. The returned values are e1, the elliptic integral of the first kind, and e2, the elliptic integral of the second kind. </p>
  
  <pre><code>  Subroutine CElliptic(e,xk,e1,e2,n)  
    ! Label: et
        real*8 e,xk,e1,e2,pi
        real*8  A(0:99), B(0:99)
        integer j,m,n
        pi = 4.d0*datan(1.d0)
        A(0)=1.d0+xk ; B(0)=1.d0-xk
        n=0
        if (xk &lt; 0.d0) return
        if (xk &gt; 1.d0) return
        if (e &lt;= 0.d0) return
    et  n = n + 1
    ! Generate improved values
    A(n)=(A(n-1)+B(n-1))/2.d0
    B(n)=dsqrt(A(n-1)*B(n-1))
    if (dabs(A(n)-B(n)) &gt; e) goto et
    e1=pi/2.d0/A(n)
    e2=2.d0
    m=1
    do j = 1, n 
       e2=e2-m*(A(j)*A(j)-B(j)*B(j))
       m=m*2
    end do
    e2 = e2*e1/2.d0
    return
    end
  </code></pre>
  
  <p>I have compiled it but I have received the following errors:</p>
  
  <p>gfortran -Wall -c "gauss.f" (nel direttorio: /home/pierluigi/Scrivania)
  gauss.f:53.9:</p>
  
  <pre><code>    50 format(' ',f4.2,'     ',f9.7,'     ',f9.7,'     ',i2)
       1
  </code></pre>
  
  <p>Error: Invalid character in name at (1)
  gauss.f:83.72:</p>
  
  <pre><code>  if (dabs(A(n)-B(n)) &gt; e) goto et
                                                                      1
  </code></pre>
  
  <p>Warning: Deleted feature: Assigned GOTO statement at (1)
  gauss.f:83.35:</p>
  
  <pre><code>  if (dabs(A(n)-B(n)) &gt; e) goto et
                                 1
  </code></pre>
  
  <p>Error: ASSIGNED GOTO statement at (1) requires an INTEGER variable
  gauss.f:48.18:
          write(*,50)  xk,e1,e2,n
                    1
  Error: FORMAT label 50 at (1) not defined
  Compilation failed.</p>
  
  <p>Any suggestions please?</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>I have read all your answers and thanks to you I managed to compile the program. I also have another curiosity and I do not know whether to write another question. In the meantime I modify this question. In my program, xk is increased by 0.05. Now I will that the program to read data from a file containing: the minimum value of xk; the maximum value of xk; the number of intervals. I thought:</p>
  
  <pre><code>  open (10,file='data/test') 
    read (10,*)  xkmi, xkma 
    read (10,*)  nk 
    close (10) 
    lkmi = dlog(xkmi) 
    lkma = dlog(xkma) 
    ldk = (lkma-lkmi)/dfloat(nk-1)
  </code></pre>
  
  <p>In addition, the program must be modified in such a way that the result is written to another file. How can I change the rest of the program? Thank you very much.</p>