write a vb script to display first 5 odd numbers from 1 to 100
Answers were Sorted based on User's Feedback
Answer / mudaseer
dim i,vcnt,vstro
vcnt=0
for i=1 to 100 step 2
vstro=vstro & i & vbnewline
vcnt=vcnt+1
if vcnt=5 then exit for
next
msgbox vstro
Is This Answer Correct ? | 14 Yes | 2 No |
Answer / eswar
cnt =0
For i=1 to 100
If (i mod 2 <> 0) Then
MsgBox i
cnt=cnt+1
End If
If cnt=5 Then
Exit for
End If
Next
Is This Answer Correct ? | 7 Yes | 3 No |
Answer / anjali tamrakar
Private sub form_load()
Dim a as integer
Dim b as integer
B=0
For A=1 to 100 step2
B=B+A
Print A,B
Next A
End sub
Is This Answer Correct ? | 5 Yes | 3 No |
Answer / psri
dim a(50)
j=0
for i = 1 to 100
if (i mod 2) <> 0 then
a(j)=i
j=j+1
cnt=cnt+1
End if
next
msgbox "The odd no is "& join(a) &"The total no of odd no's
is"&cnt
Is This Answer Correct ? | 2 Yes | 3 No |
What are lbound and ubound in the vbscript language?
write a Vb script to find a whther a selected drive exits.
What are the properties of regexp object?
Write a program to resize an array of 5 elements to 4 elements and display all the elements.
write a vb script to display factorial of a number using function
write a vb script to display the code "vbscripting" alphabet by alphabet(i e 1st v then b and up to g)
accept an email id & validate it .email id should not exceed 25 characters the mail id should contain 3 characters excluding domain name,@ and .(dot) the last 3 characters of the domain should be net,com or org
What is the event handling in vbscript?
1. How to handle object implementation change in DP for Ex: i have login page with username,pasword (editboxes),login,cancel(buttons). Here i written DP code for login page with the help properties. My questions: 1.If properites are changing dynamically i will do (i want code for that) 2.if objects are changed dynamcally i will do (i wnat code for that)
if there is any string in a given format like as "company name employeecode date" then we have to fetch employeecode form string for ex-string is "capgemini12345june2013" then we have to fetch 12345 by using vb script so guys how can we do that please reply it.
How to search word in a string without using instring function?
I want to count the total no of links present in yahoo home page. The script like Set fileSysObject=createobject("Scripting.FileSystemObject") Set linksFileName=fileSysObject.opentextfile("D:\samplelinkfile.txt",2,true) Set linkDescObj=description.Create linkDescObj("micclass").value="Link" Set noOfLinks=browser("yahoo").Page("Yahoo!India").ChildObjects(linkDescObj) For i=0 to noOfLinks.count-1 linkName=noOfLinks(i).getROProperty("name") linksFileName.writeline(linkName) Next linksFileName.close Set fileSysObject=nothing But while running the script it is fail (the object not present in the object repository).How to overcome please tell me the detail steps...for QTP9.30