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

Answer Posted / 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       View All Answers


Please Help Members By Posting Answers For Below Questions

what is the differance between BYVAL,BYREF?

1764


please can you help me to get a code of flames using a visual basic 6

1226


what is resorceallocation

1772


Compare java script and vb script?

589


How to get the length of the string by making use of the string function?

560






Mention how to access array data?

509


Which object is used to work with the excel sheets in the vbscript language and what statement is used to create this object?

480


Mention if qtp generates vbscript code as we record actions, can't it possible to directly write using vbscript code when qtp does the same thing too?

523


Which operator can be used to do an xor operation in vbscript?

676


How to throw an error in vbscript?

601


How to Import data from a file (file is on the desktop) to the data table

1554


In what way program "hello world" you can write in vbscript?

641


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

597


Explain about the functionality of vb script?

567


What purpose does ‘on error resume next’ serves?

545