Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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 purpose does ‘on error resume next’ serves?

1090


How to write functions and sub in vb script?

1112


Which in-built function is used to format the number in the vbscript language?

1023


What are the rules to name variable in vbscript?

1090


Explain the functionality of vbscript?

953


How will you reverse a string in vbscript?

1168


If we take 2 strings as “good” and “bad” then what will ‘+’ and ‘&’ operators return?

997


What are the properties of regexp object?

1117


What is event handling in vbscript?

1112


How to pass argument by reference to a function in vbscript?

1073


There are 5 web pages.write a script to click the button on 4th web page.

3424


can anyone send me a vb scripts code for clicking on a link and coming back on home page again does the same for many links on a web page.

2306


Mention what is variant in vbscript?

954


How to Import data from a file (file is on the desktop) to the data table

2015


Set srchobj=Description.Create() srchobj("type").value="text" srchobj("name").value="q" srchobj("html tag").value="input" browser("micclass:=google").Page("micclass:=google").webedit (srchobj).Set "qtp" what's wrong in my code pls tell me ? the above code working fine and i got my result pass,now i am trying to run the program it shows general run time error why?pls help me i am in learning stage ?

1931