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 / vinay vuppala
1st method
dim a
dim b
b=1
count=0
a=inputbox("enter a number")
for b=1 to a
if((a mod b)=0) then
count=count+1
end if
next
if count>2 then
msgbox("the number "& a &" is a not prime number")
else
msgbox("the number "& a &" is a prime")
end if
| Is This Answer Correct ? | 17 Yes | 6 No |
Post New Answer View All Answers
Explain the tristate constants in vbscript?
What is the event handling in vbscript?
What is dictionary object in vbscript? Explain?
i have a problem with this error(this error related edit and
delete button,when i click this button in datagrid..i will
get this error)"Invalid postback or callback argument.
Event validation is enabled using
Explain the adodb.stream class?
Which operator is used for fetching the modulus of the 2 numbers in the vbscript language?
How to identify column in VSFlexgrid? My VSFlexgrid window is identified as 'Active X Control'
How to create a cookie using vbscript?
How to write functions and sub in vb script?
I have attended Anovatek Software QTP interview. They will give us computer and one web based application with QTP. We have to automate some records (already updated records or new records) using QTP Data driven testing. But we should use for loop? Can any one know how to do data driven testing using For loop?
Is VB Script Case sensitive or Case insensitive?
Explain about constants in vb script?
create a form to accept username and password validate the username and password with using message box, display the corresponding user message
How to use QTP Object in .vbs(vbscript file) file Ex: Browser().., wait(), exist() and etc...
Which operator can be used to change the value of the operand or change the state of the condition?