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 / ravi salunkhe
val=Inputbox("enter any number")
valprime=0
For i=2 to sqr(val)
If (val mod i)=0 Then
msgbox "not a prime number"
valprime=1
Exit for
End If
Next
If valprime=0 Then
msgbox "prime number"
End If
this will chop off the looping by limiting the loop to the
square root of the number!...\M/...mosh!
| Is This Answer Correct ? | 4 Yes | 0 No |
Post New Answer View All Answers
What is the difference between do until loop and do while loop?
create a form to accept username and password validate the username and password with using message box, display the corresponding user message
How will you get the smallest subscript of an array in vbscript?
Which command is used for writing text on a page?
Why is it recommended to close the database connection every time after the work is completed?
How can the spaces from the string be removed?
what is the standards used for writing the script in QTP
What are the environments supported by vbscript language?
If a calulator having 3 buttons (of any number)in 3 of them one is not working properly due to which answer is wrong always. write a script to find out which button is not working properly ?
What are the uses of vb script?
What is Procedure or Subroutine in VB Script?
Mention what is select case statement?
How will you get the last occurrence of one string within another string using vbscript?
what is resorceallocation
how to automatically update the sql server2005 database records when insert in vb6?