Sponsored Ad

Monday, November 1, 2010

QTP: Find Odd Numbers Between a given Range

Steps to find Odd Number in VBScript:

1. Loop through a set of  numbers

2. Divide the number from 2 if it not divisible, it is Odd number.

QTP Program to Find Odd Numbers:

<html>
<body>

<script type="text/vbscript">

Dim vStart 
Dim vEnd 
Dim icount 
vStart =1 
vEnd=12
Dim vResult
For icount = vStart to vEnd   
    If icount  mod 2 <>0 Then 
        vResult = vResult & "," &  icount 
    End If 
Next
msgbox vResult

</script>
</body>
</html>

Output:

QTP: Find Odd Numbers Between a given Range

Where to Run This Program:

1. This VBScript Program code either you can use in QTP editor  (code between <script> and </script> tags ) and run it.

2. Write in Notepad, save with .htm extension and run on internet explorer.

0 comments:

Post a Comment

Sponsored Ad

Development Updates

Tech Updates