1(a)  What interesting property of the input array is the routine below attempting to discover? 
1(b)  Do you believe there are any logical errors in the routine below? 
1(c)  What problems, if any, would you anticipate if this routine was deployed in a commercial application? 
1(d) Re-implement this routine in a form you would be happy to put your name to. Any language is acceptable for this task.
Procedure DiscoverSomethingInteresting(Input : Array Of Integer; Out x, y, z : Integer);
Var
    i, j, k : Integer;
    w       : Integer;
Begin
    z := -MaxInt;
    For i := 1 To Length(Input) Do
    Begin
        For j := 0 To Length(Input) - i Do
        Begin
            w := 0;
            For k := 0 To i - 1 Do
            Begin
                w := w + Input[j+k];
            End;
            If w > z Then
            Begin
                z       := w;
                x       := j;
                y       := j+i-1;
            End;
        End;
    End;
End;Notes : The sample above is written in the Delphi language. The array is zero based and the Length function returns the number of elements in the array.