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

What is the technology used by vb script?

539


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

2057


What methods are used to create text files and open text files in the vbscript language?

532


I have an excel sheet with multiple ID's in a column. Now i need fetch those ID's in an application and check whether if it already exist in the DB. If not then i have to go with the process of inserting them in the DB. If it exists then i need to skip that ID and move to the next ID and check the same and proceed. How can i do that with for loop and if condition?

862


Explain about scrrun.dll?

528






how does vb script help in web page designing? explain with example.

1584


How will you convert a string to lower case string using vbscript?

553


how to automatically update the sql server2005 database records when insert in vb6?

1483


How to scroll down a page while recording in qtp. suggest me any method apart from low level recording.

2569


how to write a vb script in QTP for yahoo registration form, i want to check the performance also like performance test, stress, load test like that.

4739


hi all, i had a question, that how to find out hiding a coloumn in a table i had a table having the following column names NAME DESCRIPTION CREATED TIME CREATED USER if i right clicked on a NAME column it will displays a menu having the same column names in a list like NAME DESCRIPTION CREATED TIME CREATED USER with check boxes.if i unched any check box, that column name should not be appear in the main table column names could anyone please solve this problem?

1546


How will you compare two strings in vbscript?

592


Can someone please tell me what poor design in a relational database (not the layout or style) is and how it can be avoided? PLEASE...im desperate.

1411


What is the difference between VBScript and JavaScript?

2055


Plzzzzzzz can any one tell me which is the best institute in hyderabad for learing VBScript. plz do answer guys its urgent plzzzzzzz. thanks in advance.

1720