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

In what way program "hello world" you can write in vbscript?

894


How can you create an object in vbscript?

844


What are the data types supported by vbscript?

818


where can i learn VB scripint ?

1849


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

1710


Capture the Unique label changes on google home page for I am feeling lucky button and save those label changes to Notepad Note: Using QTP

2096


In the Web page we have a table link, if we click on that link all the contents under that link will be sorted (asscending/Descending). Now i want to check in which order the list is ? for that i need to get the data in to some var How can i get that cells data?

2241


What purpose does ‘on error resume next’ serves?

805


Mention what is byref and byval parameters in vbscript?

790


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.

2073


Can u describe what kind of testing are for OTC derivates by banks.

1899


What are the properties of regexp object?

813


Sub link() Dim k As Integer Dim rand As Integer Dim URL As String Dim foldernum As Integer Dim folderstring As String Dim filenum As Integer Dim filestring As String k = 1 'for AC Numbers For i = 11 To 40 foldernum = 0 foldernum = 1000 + i folderstring = CStr(foldernum) folderstring = Mid(folderstring, 2, 3) folder = "ac" & folderstring 'folderstring = Sheets(2).Cells(i, 1) ' for Number of Random files For j = 1 To 10 rand = Int(Rnd * (200 - 1) + 1) filenum = 0 filenum = 1000 + rand filestring = CStr(filenum) filestring = Mid(filestring, 2, 3) 'URL = "http://ceobihar.nic.in/PSCDROM/ac" & folderstring & "/i" & folderstring & "0" & filestring & ".pdf" URL = "http://www.elections.tn.gov.in/pdfs/dt1/" & folder & "/" & folder & filestring & ".pdf" ' URL =http://www.wb.nic.in/wbeco/EROLLS/PDF/English/A001/a0010105 .pdf Cells(k, 1) = folderstring Cells(k, 2) = folder Cells(k, 3) = filestring Cells(k, 3) = URL k = k + 1 Next j Next i End Sub plz define it

2507


did any one attended interview in applabs if you had gone through plz tell me the procedure

2063


I am working on QTP, got struck in one place.. In my application depending upon configuration WebEdit count is increasing/ decreasing.. how to get these webedits..

2021