* declare space for the pascal triangle up to n = 20. integer tab (0:20,0:20) * open the output file for the pascal triangle. open(1,file='binom.tab',status='unknown') * Make sure the output file is at beginning of file. * This is really a redundant operation under the unix system. rewind 1 * Fill the left edge of the triangle do 1 n = 0,20 tab(n,0) = 1 1 continue * Complete the second row of the triangle. tab(1,1) = 1 * complete the triangle for rows 2 through 20. do 4 n = 2,20 do 3 j = 1,n tab(n,j) = tab(n-1,j-1) + tab(n-1,j) 3 continue 4 continue * write out the triangle. do 5 n = 0,20 write(1,8)n m1 = min0(5,n) write(1,6)(j,j=0,m1) write(1,6)( tab(n,j),j=0,m1) write(1,*) if(m1.eq.n)go to 5 m2 = min0(10,n) write(1,7)(j,j=6,m2) write(1,7)( tab(n,j),j=6,m2) write(1,*) if(m2.eq.n)go to 5 m3 = min(15,n) write(1,7)(j,j=11,m3) write(1,7)( tab(n,j),j=11,m3) write(1,*) if(m3.eq.n)go to 5 m4 = min(20,n) write(1,7)(j,j=16,m4) write(1,7)( tab(n,j),j=16,m4) write(1,*) 5 continue 6 format(10x,6i10) 7 format(20x,5i10) 8 format(' N = ',i5) rewind 1 stop end