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


Please Help Members By Posting Answers For Below Questions

What is byref and byval parameters in vbscript?

850


What is sql loader? Explain the files used by sql loader to load file?

897


Mention characteristics of sub procedures?

834


How to take whole text output from screen of Bitmap Application.

2107


How do i automate a website www.flyashx.com without having any test cases witin a week time.

1686


Explain the functionality of vbscript?

729


what types of bugs will we find out in banking projects for automation testing?

2018


How will you get a subset of a array in vbscript?

800


What's the difference between vbscript and vb.net?

834


Which operator is used to perform the comparison among 2 operands in the vbscript language?

746


What are the naming conventions while declaring a variable in the vbscript language?

860


How to create a cookie using vbscript?

878


I want to run QTP script on Linux server is it possible to do this by connecting Windows to Linux through VPN/Terminal Server and just run the script on Linux server.

2041


how to write validation function for date in vb script

2370


Explain about scrrun.dll in vbscript?

895