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 / naga siva sankar
val=Inputbox("enter any number")valprime=0
For i=2 to Int(val/2)
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
| Is This Answer Correct ? | 37 Yes | 15 No |
Post New Answer View All Answers
What are the properties of regexp object?
How to declare an array in vbscript?
How will you convert a string to lower case string using vbscript?
What is the use of the ‘open’ method to work with the database in the vbscript language and what connection string is passed in the same and what is its usage?
Differentiate javascript and vbscript?
We have 1 web page with names column. I am giving the Service Providers1,2,3.... @ that time dynamically some no of names are displaying in the webpage and The Pop up windows are opening(No.of Pop Up windows=No.of Names). The names may be diffar for each and every Service Provders (Dynamically) How can we handle the Dynamic values?
How will you reverse a string in vbscript?
What are lbound and ubound in the vbscript language?
How strcomp function works?
How will you get a combined string from array of string in vbscript?
What's the difference between vbscript and vb.net?
how to check whether link is disabled in QTP??
Set srchobj=Description.Create() srchobj("type").value="text" srchobj("name").value="q" srchobj("html tag").value="input" browser("micclass:=google").Page("micclass:=google").webedit (srchobj).Set "qtp" what's wrong in my code pls tell me ? the above code working fine and i got my result pass,now i am trying to run the program it shows general run time error why?pls help me i am in learning stage ?
How to throw an error in vbscript?
What is the output of a + b in vbscript if a = 5 and b = 10?