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

How to replace junk code recorded by QTP with a mall function.

1646


How will you get the exponent of the given number in vbscript?

551


What are the data types supported by vbscript?

577


What is the use of option explicit in vbscript?

542


What is the purpose of the err object in the vbscript language?

618






How do i automate a website www.flyashx.com without having any test cases witin a week time.

1449


Hi anyone Can Send Solution to the Question wt m posting now Prepare Script for the Bellow Scenario? Login to Gmail Page Open Inbox check Mails save them in a Folder

1568


Illustrate briefly about the different types of statement

2019


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?

3551


What aspects of vbscript make it safe so that a web page using vbscript cannot destroy or corrupt information on a user's computer?

575


Both Static and dynamic arrays are handled by VB script. Is it true?

608


Which function is used in the vbscript language to convert the specified expression into a date type value?

520


What are the environments supported by vbscript language?

498


what is the differance between BYVAL,BYREF?

1765


Explain sga memory structures?

577