Hi, Anybody could you Please tell me How to write the
script for Checking whether given number is Prime Number or
not..Thanks in Advance

Answer Posted / nisar

Dim i,num
num=CInt(InputBox("Enter the numbers to limit the
Prime:"))
i = 3
While i <= num
bIsPrime = True
j = 2
While j <= i\2 And bIsPrime
bIsPrime = i Mod j > 0
j = j + 1
Wend
If bIsPrime Then
Wscript.echo("Found a prime number: " & i)
End If
i = i + 2
Wend

Is This Answer Correct ?    0 Yes 7 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is purpose of scripting.filesystemobject class in vbscript?

638


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

542


after medical test,when will be the police verification

1731


How will you get a string with the specified character the specified number of times in vbscript?

581


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.

1848






Hello friends..... Can any give the methods for Ms-Access, and Mozilla firefox in Automation Object Model in QTP. Please give me currect answers... if you do not understand my question please don't give answers. Thanking you.

1858


Explain about scrrun.dll in vbscript?

666


how to write codings in QTP using vb script. please help me. i am new to QTP. it is easy or very much tough. please tell me

12924


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

1482


How to Enter Values on the Command promt using VB script

1540


How to get the length of the string by making use of the string function?

579


can anyone tell me the procedure of interview held in applabs

1763


while using Keyward driven framework in QTPif new requirements are added how to manage it...plz ans

1578


For a webbased application:- what should be code in expert veiw, for retrieving a single column name "username" from a server and checking whether exported "username" from datatable doesn't exist in server. suppose i have saved in excelsheet a username="gayatri" , which is exported, then checked for whether this username "gayatri" exist in server database or not ? if exist then allow to enter new username, which should be again checked for in loop , or else come out of loop and enter a distinct "username". plz let me have this answer in my id gayatrisahooin@hotmail.com

1763


What are the rules to name variable in vbscript?

592