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 special sub-types in vbscript?
Hi anyone Can Send Solution to the Question wt m posting now Prepare Script for the Bellow Scenario? Login to Gmail Page Open Inbox check Mails save them in a Folder
How to add actions in driver script to run those actions in QTP?
Which keyword is used to declare a variable in the vbscript language?
What is vbscript?
Is vbscript a case-sensitive or case-insensitive?
Which conditional statement is the most convenient one to use in the case of multiple conditions in the vbscript language?
Mention what are the rules to name variable in vbscript?
When to use function procedures and what are its characteristics?
what is the use of QCUtil? explain with one example?
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
if u ve resrevation for train and u get a number supose 1234xxxokie.after sucessul entering all required fields. now u put that number in search and want to chk wether these ar same or not if both ar same then its okie otherwise test fail.what would be the vb script code for it to compare these two values of different page.
Which function is used to perform string comparison?
What are subprocedures in vbscript?
What methods are used to create text files and open text files in the vbscript language?