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 |
How to access array data?
Hi, Anybody could tell me What is the 3rd Largest Number in the series..Thanks in Advance..
How to identify column in VSFlexgrid? My VSFlexgrid window is identified as 'Active X Control'
which is the good software training centre in bangalore?
Explain about scrrun.dll?
what is visual basic?
Both Static and dynamic arrays are handled by VB script. Is it true?
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.
i need to sort the data using qtp script for this how i need to write a qtp script
write a vb script to display the number is odd or even and whether it is divisible by 9 or not
Write a Program to add 2 numbers without using operators (+,-) and without using third variable. Note: Use VBScript only Hint: You can use other operators like '/' & '*'(Division & Multiplication)
Plzzzzzzz can any one tell me which is the best institute in hyderabad for learing VBScript. plz do answer guys its urgent plzzzzzzz. thanks in advance.