title: Pascal Triangle in FORTRAN
body: <p>I'm trying to create pascal triangle with FORTRAN. I did the algorithm. Compiled in C and succeeded but for some reason I'm not getting the same desired result in FORTRAN. Can anyone help me out in this one?</p>
  
  <p>Code in C (Working):</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  
  int main()
  {
    unsigned int c, i, j, k,n;
    scanf("%d",&amp;n);
  
    for(i=0; i &lt; n; i++) {
      c = 1;
      for(j=1; j &lt;= (n-1-i); j++) printf(" ");
      for(k=0; k &lt;= i; k++) {
        printf("%2d", c);
        c = c * (i-k)/(k+1);
      }
      printf("\n");
  
    }
    return 0;
  }
  </code></pre>
  
  <p>Code in FORTRAN (Not Working, Need help here):</p>
  
  <pre><code>program pascal
    implicit none
    integer i,j,k,p,n
    read(*,*)n
    i=0
    do while(i.lt.n)
      p=1
      do j=1,n-1-i
      write(*,5)
      5 format(1x)
      enddo
      do k = 0,i
      write(*,1)p
      1 format(i2)
      p = p*(i-k)/(k+1)
      enddo
      i=i+1
      write(*,2)
      2 format(/)
      enddo
  endprogram
  </code></pre>