write a vb script to display first 5 odd numbers from 1 to 100

Answers were Sorted based on User's Feedback



write a vb script to display first 5 odd numbers from 1 to 100 ..

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

write a vb script to display first 5 odd numbers from 1 to 100 ..

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

write a vb script to display first 5 odd numbers from 1 to 100 ..

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

write a vb script to display first 5 odd numbers from 1 to 100 ..

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

Post New Answer

More VB Script Interview Questions

What are keywords in the vbscript language?

0 Answers  


Hai this is sheik, i want to learn VB scripts for web application pls guide me what are all basic things need to know to learn VB scripts in web application.

0 Answers  


Explain the arrays in vb script?

0 Answers  


Which object provide information about a single runtime error in a vbscript?

0 Answers  


write a function to read the items from combobox of Flight reservation & save in excel (QTP)??

0 Answers  






Which constant is used for print and display functions and works as same as pressing enter key?

0 Answers  


Can anyone send me a vb script function for verifying the functionality of active links on a web page

0 Answers   Zensar,


What is vbscript language used for and which earlier language is it modeled upon?

0 Answers  


Explain about tristate constants?

0 Answers  


accept a string & display whether a is present or not

1 Answers  


Why is the use of exit do or exit for statements within loops discouraged?

0 Answers  


Explain vbscript in detail?

0 Answers  


Categories