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 |
Explain about operator precedence in vb script?
How do display output message without using msgbox function?
What are keywords in the vbscript language?
How to Import data from a file (file is on the desktop) to the data table
can anyone send me a vb scripts code for clicking on a link and coming back on home page again does the same for many links on a web page.
What is dictionary object in vbscript? Explain?
What are the different types of operators and their order of precedence?
Write a Script for ATM in QTP
What is the purpose of folders object of scripting.filesystemobject class in vbscript?
Explain the extension .hta?
Write a function for Instr(). We need to write a function that works as same as Instr(). Code or Even pseudo code is good enough for me.?
how to declare a variable in vbscript using vbscript