-- -*- mode: eiffel -*-
-- $Id: nestedloop.se,v 1.1 2000/12/30 21:42:57 doug Exp $
-- http://www.bagley.org/~doug/shootout/

class NESTEDLOOP

creation make

feature

   make is

      local
     n,a,b,c,d,e,f,x: INTEGER;
      do
     if argument_count = 1 then
        n := argument(1).to_integer
     else
        n := 1
     end

     x := 0
     from
        a := 0
     until
        a = n
     loop
        from
           b := 0
        until
           b = n
        loop
           from
          c := 0
           until
          c = n
           loop
          from
             d := 0
          until
             d = n
          loop
             from
            e := 0
             until
            e = n
             loop
            from
               f := 0
            until
               f = n
            loop
               x := x + 1
               f := f + 1
            end
            e := e + 1
             end
             d := d + 1
          end
          c := c + 1
           end
           b := b + 1
        end
        a := a + 1
     end

         std_output.put_integer(x)
         std_output.put_character('%N')
      end;

end