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
Hi this is Vinoth. I need a help on below mentioned question A combobox contains list of items assume as 5 I have to get each items Individually and I have to Export to datatable. Please help me on this. Thanks
Mention what is vbscript procedures?
What is the use of the formatdatetime function in the vbscript language?
Write a Program to add 2 numbers without using operators (+,-) and without using third variable. Note: Use VBScript only Hint: You can use other operators like '/' & '*'(Division & Multiplication)
how to increase the values in text box in a given text box increament by two values by clicking on button
Mention how to create a cookie using vbscript?
What is vbscript?
What are the advantages of vbscript?
Explain about filter expression?
Which function is used to perform string comparison?
Can any one provide code for Mid(string,start[,length]). I have been asked to write code for Mid(). i.e We need to define our own function say MyMid() which should behave same like built-in Mid function
while using Keyward driven framework in QTPif new requirements are added how to manage it...plz ans
PLz send me the VB scripts which is having more examples my email id : hareen_11@yahoo.com
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?
Mention when to use function procedures and what are its characteristics?