Write the vb script for the lowest and highest values of an
array?
Answer Posted / pramod mallick
Dim x(5)
x(0) = 1
x(1) = 3
x(2) = 3
x(3) = 5
x(4) = 2
Dim y
Dim strArray
'Display
For y = LBound(x) To UBound(x)
strArray = strArray & x(y) & ","
Next
MsgBox "Before Sorting " & strArray
Dim z
'Demo loop
For z = LBound(x) To UBound(x)
For y = LBound(x) To UBound(x) - 1
Dim lower As Integer
Dim higher As Integer
If x(y) > x(y + 1) Then
higher = x(y)
lower = x(y + 1)
x(y) = lower
x(y + 1) = higher
ElseIf x(y) > x(y + 1) Then
higher = x(y)
lower = x(y + 1)
x(y) = lower
x(y + 1) = higher
Else 'equal
'do nothing
End If
Next
Next
'Display
strArray = ""
For y = LBound(x) To UBound(x)
strArray = strArray & x(y) & ","
Next
MsgBox "After sorting " & strArray
msgbox "Lowest is " & Lbound(x) & "Highest is " Ubound(x)
| Is This Answer Correct ? | 3 Yes | 1 No |
Post New Answer View All Answers
can any one please tell me which is the best institute in Bangalore to learn QA (crash course)? Thanks
how to download mercury qtp9.2 ny internet ?
What are the different properties of an web object
How many add-ins comes by default with qtp?
in data driven testing for performing operations which method is easy from manual test data,keyword view,or from database.and why?
Explain xml checkpoints.
is it possible to add sheets to excel at runtime
What kinds of security (firewalls, encryptions, passwords, etc.) will be required and what is it expected to do? How can it be tested?
What is ObjectParamater?
Explain the concept of how quicktest professional identifies object?
wht is Manual Testing Frame work. Pls anybody can give appropriate answers
How to handle dynamic objects in quicktest professional?
What is the parameterization? Give one example?
Difference between action & Reusable action?
What are the common defects found in your project? (in qtp interview)