Hi, Anybody could you Please tell me How to write the
script for Checking whether given number is Prime Number or
not..Thanks in Advance

Answer Posted / manu

x=inputbox("enter a number")

prime = TRUE
for i = 0 to x-1
if x mod 2 = 0 then
prime = FALSE
end if
next

if prime then
msgbox "prime number"
else
msgbox "not prime"
end if

Is This Answer Correct ?    0 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Mention what is vbscript procedures?

536


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

2391


Mention what is the use of option explicit in vbscript?

547


What is the use of the recordset object and which statement is used to create such an object?

527


Explain the arrays in vb script?

585






Mention the rules for using option explicit statement?

481


Explain about constants in vb script?

571


Mention when to use function procedures and what are its characteristics?

625


Write a Script for ATM in QTP

3337


How will you get the natural logarithm of the given number in vbscript?

601


What is the difference between for loop and while loop?

550


I am working on QTP, got struck in one place.. In my application depending upon configuration WebEdit count is increasing/ decreasing.. how to get these webedits..

1801


Mention the environments where vbscript could be run?

658


What are class events?

581


what do you mean .ota mobile format

1937