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.
Answers were Sorted based on User's Feedback
Answer / pankaj
Function IsPrime(Num)
Dim varNum, varCtr, varLimit
varLimit = Round(Num/2)
For varCtr = 2 To varLimit
varNum = Num Mod varCtr
If varNum = 0 Then
IsPrime = False
Exit For
End If
Next
If varCtr >= varLimit Then
IsPrime = True
End If
End Function
MsgBox IsPrime(19)
Is This Answer Correct ? | 1 Yes | 3 No |
Answer / sayali
Dim prime, n
prime = TRUE
n=cint(inputbox("Enter a number to find whether it is Prime or Not"))
for i=2 to (n-1)
If n mod i = 0 then
prime = False
Exit for
End if
Next
If prime then
msgbox "Yes! It is a Prime number"
Else
msgbox "No! it is not a prime number"
End if
Is This Answer Correct ? | 0 Yes | 2 No |
wat is com(common object model)object for mozilla firefox??? if any knows the exact answer....plz rply me
compare the string without using stringcomp function?
what types of bugs will we find out in banking projects for automation testing?
0 Answers Napier Healthcare, TCS,
Explain the functionality of vbscript?
Explain some uses of vb script?
how to get date format from system locale..format means neither long nor shor... format from system locale. i need like your date is mm/dd/yyyy formate or mm-dd-yy or with time like that. how to get.
Like OPTION EXPLICIT statement what are the other statements used in vbscript and their usage. Please post me all the statements please.
which one is more secure vb script or java script ??????? or both are same ??????
Develop a parameterized action that accomplishes the following a. Launch a browser of users choice ( example : IE, chrome etc) b. Open up a search engine (Google, Bing etc) c. Perform a search d. Click a particular link depending on the user’s choice ( 1st , 2nd or third link)
What is string concatenation function in VBScript?
what is extension of the file if its saved from recovery manger to some drive
What are class events?