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 about vb script?
Explain different types of segment?
what is the differance between BYVAL,BYREF?
what types of bugs will we find out in banking projects for automation testing?
Which in-built function is used to format the number in the vbscript language?
Explain the support of asp for vb script functionality?
Explain about the support of asp for vb script functionality?
What are the valid scopes of a variable in vbscript?
Could Anybody Please tell me What is the script for Find 3rd Largest element in the Array without using a SORT function int Find(int arr[], int size); Thanks in Advance..
filter the array values without using filter function?
How to make sure that items in a wintree are sorted al?
How strcomp function works?
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
Difference between dim,public and private variables in vb script?
Which in-built function related to an array joins substrings into one string in the vbscript language?