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 are the differences between sub procedures and function procedures?
Give me sm ideas to write Vbscripts abt protocol testing abilash700@gmail.com.
Which constant is used for print and display functions and works as same as pressing enter key?
Mention what is byref and byval parameters in vbscript?
How to open a file. What is the perpose of true and false mode there?
How to open excel in vb script?
How will you check that a variable is an array in vbscript?
What is the use of the formatdatetime function in the vbscript language?
What is the main difference between function and sub-procedure?
How will you reverse a string in vbscript?
Can automation testing find ssame no. of bugs what we can find by manual testing?
Dear All, I am geting below IE error whilie executing the QTP scripts in Batch mode "Internet Explorer has encountered a problem and needs to close. We are sorry for the inconvenience." can any one suggest me how to resolve this issue . Thanks Balaji
how to answer "TELL ME ABOUT UR SELF" as exp.person. whr to start and whr to stop. can anyone tel me
Difference between dim,public and private variables in vb script?
who will create the object?