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 / pankaja yathindrakumar
' Script to find if the given number is Prime or Not
Function Prime(n)
If n<=1 Then
Exit Function
Else
Flag="Prime"
For i=2 To n-1
If n Mod i=0 Then
Flag ="Not Prime"
End If
Next
End if
Prime=Flag
End Function
Res=Prime(6)
MsgBox Res
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
What are the properties of regexp object?
what is the features of visual basic?
Explain about tristate constants?
Which operator can be used to check if two numbers are equal or not in vbscript?
Explain about constants in vb script?
where can i learn VB scripint ?
about vb scripting programs this type of all question& answers
how to write codings in QTP using vb script. please help me. i am new to QTP. it is easy or very much tough. please tell me
wat is the com(common object model)object for mozilla firefox???????plz if any one know the exact answer....reply me......
How to assign a numeric value to a variable?
For a webbased application:- what should be code in expert veiw, for retrieving a single column name "username" from a server and checking whether exported "username" from datatable doesn't exist in server. suppose i have saved in excelsheet a username="gayatri" , which is exported, then checked for whether this username "gayatri" exist in server database or not ? if exist then allow to enter new username, which should be again checked for in loop , or else come out of loop and enter a distinct "username". plz let me have this answer in my id gayatrisahooin@hotmail.com
Which in-built function related to an array joins substrings into one string in the vbscript language?
Explain about tristate constants in vbscript?
How will you get the natural logarithm of the given number in vbscript?
How can you fetch the value of a cookie?