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
What is the difference between vbscript and vba?
Program to use input box and send even numbers into sheet1 and odd numbers into sheet2 and prime numbers into sheet3 using vbscript(QTP)?
Write a code to print numbers from 5 to 0?
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.
How to delete a cookie using vbscript?
What is the difference between function and procedure?
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...
How will you convert a string to lower case string using vbscript?
Write a vbscript procedure that converts feet to inches. Hint: there are 12 inches in a foot?
How to assign a numeric value to a variable?
What are the 2 ways in which a variable can be declared in the vbscript language?
Out of the different type of operators, which are evaluated first and last in the vbscript language?
How will you compare two strings in vbscript?
Explain vbscript in detail?
How to write a VBscript for web page performance test i need a code send if any knows the code If any knows VBScript book plz send to me the link to my mail plz