Algorithms/Find maximum/vb script method 5

 function findNoOfElement(i_intAry) Dim o_intCount o_intCount = 0 for each objEle in i_intAry o_intCount = o_intCount + 1 next findNoOfElement = o_intCount end function function findMax(aa) Dim p_blnFound p_blnFound = true do while p_blnFound = true p_blnFound = false Dim index for index = 0 to (findNoOfElement(aa) - 2) if ( aa(index) > aa(index + 1) ) then Dim tmp tmp          = aa(index) aa(index)    = aa(index + 1) aa(index + 1) = tmp p_blnFound   = true end if         next loop Dim o_intR o_intR = findNoOfElement(aa) - 1 findMax = aa(o_intR) end function Dim cc(4) cc(0) = 11 cc(1) = 2 cc(2) = 6 cc(3) = 4 cc(4) = 1 document.write("Max is " & findMax(cc))