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
Explain about operator precedence in vb script?
How to declare an array in vbscript?
What if you do not specify anything when you call a procedure?
Illustrate briefly about the different types of statement
Explain the operator precedence in vb script?
What are the different types of operators and their order of precedence?
what is used of Property........End Property loop ? how to write the script for it?
What is the difference between a dictionary and an array?
How will you compare two strings in vbscript?
Which function allows you to instantiate an object given its programmatic identifier or progid?
Which keyword is used to declare a variable in the vbscript language?
why do u choose to go for testing why cant for devoloping
How to find the font in qtp. Scenario:After entering the username and passwd you will be navigate into the "welcome:Username" page.Now I want to extarct font for this message.
how to operate webobjects in a webpage using getobject function and then using generic methods?
How to make professional test report using vbscript code in UFT, which gives us complete analysis of the test.