Could Anybody tell me VBScript for
Check if a given number is Prime number-Don't use any Built-
in Functions Boolean/int is Prime(int number).. Thanks in
advance.

Answer Posted / mudaseer

vnum=inputbox("enter the number")
for i=2 to vnum-1
if(vnum mod i)=0 then
vf="no"
exit for
else vf="yes"
end if
next
if vf="no" then
msgbox "not a prime"
else
msgbox "it is a prime"
end if

Is This Answer Correct ?    9 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the use of option explicit in vbscript?

598


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.?

2102


In the Web page we have a table link, if we click on that link all the contents under that link will be sorted (asscending/Descending). Now i want to check in which order the list is ? for that i need to get the data in to some var How can i get that cells data?

2088


Mention what is the difference between vbscript and vba?

581


How will you reverse a string in vbscript?

673






What is the extension of the vbscript file?

605


Explain vbscript in detail?

672


Hi Friends my Question is very simple,in Manual testing when we click on a hyper link it directs us to the relavent page or it re-directs us to the current page,so there we can easily write testcase but same thing if we do in automation script using QTP & need to generate report using Reporter.report event how we will do it?thanks in advance...

1709


while using Keyward driven framework in QTPif new requirements are added how to manage it...plz ans

1644


Mention what is the technology used by vb script?

575


Which conditional statement is the most convenient one to use in the case of multiple conditions in the vbscript language?

585


How many types of procedures are available in the vbscript language?

592


How to assign a numeric value to a variable?

705


What are the disadvantages of vbscript?

721


How to create a function in vbscript?

642