      function fac(n)

c
c  Function FAC calculates n!
c
      if(n.lt.0)pause ' FAC:  Bad argument detected'
      if(n.eq.0.or.n.eq.1)then
         fac=1
         else
            fac=n
            fac2=fac
   30       fac2=fac2-1.
            fac=fac*fac2
            if(fac2.gt.2)go to 30
            end if
      return
      end
