print the array values in ascending order?

Answer Posted / cnu_thatavarthi

arr = Array(4, 6, 2, 7, 3, 5, 1, 8, 10, 22, 33, 15, 11, 8)

For i = LBound(arr) to UBound(arr)
For j = LBound(arr) to UBound(arr) - 1
If arr(j) > arr(j + 1) Then
TempValue = arr(j + 1)
arr(j + 1) = arr(j)
arr(j) = TempValue
End If
Next
Next

s = ""
For i = LBound(arr) To UBound(arr)
s = s & arr(i) & ","
Next

Msgbox s

'Expected output
---------------------------

---------------------------
1,2,3,4,5,6,7,8,8,10,11,15,22,33,
---------------------------
OK
---------------------------

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Compare java script and vb script?

688


Hi this is Vinoth. I need a help on below mentioned question A combobox contains list of items assume as 5 I have to get each items Individually and I have to Export to datatable. Please help me on this. Thanks

1812


How will you convert a given number to long in vbscript?

572


How will you convert a string to upper case string using vbscript?

638


Description.Create

2229






What are the different types of operators and their order of precedence?

661


1) How can we use VB script in testing the application? 2) What all are the things(Software application to be installed in PC) we need to learn VBscript?

3645


How will you get the natural logarithm of the given number in vbscript?

686


What is the scope of a constant declared using public?

642


How you can call vbscript functions?

658


write a program to display configuration of a local system with the help of vb script.

1773


Hai this is sheik, i want to learn VB scripts for web application pls guide me what are all basic things need to know to learn VB scripts in web application.

1524


i have a problem with this error(this error related edit and delete button,when i click this button in datagrid..i will get this error)"Invalid postback or callback argument. Event validation is enabled using in configuration or <%@ Page EnableEventValidation="true" %> in a page. For security purposes, this feature verifies that arguments to postback or callback events originate from the server control that originally rendered them. If the data is valid and expected, use the ClientScriptManager.RegisterForEventValidation method in order to register the postback or callback data for validation." this is my code : <%@ Page Language="VB" Debug="false" %> <%@ import Namespace="Sytem.Data" %> <%@ import Namespace="System.Data.OleDB" %>

(Search Based On Staff I.C No) IC.No (XXXXXX-XX-XXXX)   ' runat="server"> ' runat="server"> ' runat="server"> ' runat="server"> ' runat="server"> ' runat="server"> ' runat="server"> ' runat="server"> ' runat="server"> ' runat="server"> ' runat="server"> ' runat="server"> ' runat="server"> ' runat="server"> ' runat="server"> Total Leave Taken : Days

2412


How to find the font in qtp. Scenario:After entering the username and passwd you will be navigate into the "welcome:Username" page.Now I want to extarct font for this message.

1833


What are the data types supported by vbscript?

673