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 / kanikira

a = cint(Inputbox("Enter a number to check whether it is a
prime number or not"))
count = 0
b = 1
Do while b<=a
if a mod b = 0 then
count = count +1
end if
b=b+1
Loop
If count = 2 Then
msgbox "The number "&a& " is a prime number"
Else
msgbox "The number "&a& " is not a prime number"
End if

Is This Answer Correct ?    12 Yes 6 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Hi Friends my Question is very simple,in Manual testing when we click on a hyper link it directs us to the relavent page or it re-directs us to the current page,so there we can easily write testcase but same thing if we do in automation script using QTP & need to generate report using Reporter.report event how we will do it?thanks in advance...

2036


Explain the functionality of vbscript?

884


who will create the object?

2135


What is the difference between function and procedure?

1141


what is diff between static and dynaic arrys?

2083


We have 1 web page with names column. I am giving the Service Providers1,2,3.... @ that time dynamically some no of names are displaying in the webpage and The Pop up windows are opening(No.of Pop Up windows=No.of Names). The names may be diffar for each and every Service Provders (Dynamically) How can we handle the Dynamic values?

2137


What are the properties of regexp object?

1031


Does VB/Win make standalone .EXE files?

3349


How will you compare two strings in vbscript?

1001


How to assign a date value to a variable?

1038


HOw we can apply web service checkpoint in QTP 9.5? I tried it out with net connection also. But not getting success.

2467


Can automation testing find ssame no. of bugs what we can find by manual testing?

1912


Like OPTION EXPLICIT statement what are the other statements used in vbscript and their usage. Please post me all the statements please.

2055


What is the use of option explicit statement?

944


how to acces the remote mechine using vb cript(QTP)

1970