Friday, 9 September 2016

VBscript:Sorting Numbers in Descending Order

dim a
a=array(1,5,6,7,8,9,0)
ub=ubound(a)
lb=lbound(a)

For i=lb to ub-1 Step 1



   For j=lb+i  to ub  Step 1
        if a(i)<a(j) then
         temp=a(j)
         a(j)=a(i)
         a(i)=temp
        end if
    Next


Next


'Print Sorted Array

for i=lbound(a) to ubound(a) Step 1
msgbox a(i)

Next







No comments:

Post a Comment

Spring Boot : Exception Handler 14