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
Explain a few date functions in vbscript
if u ve resrevation for train and u get a number supose 1234xxxokie.after sucessul entering all required fields. now u put that number in search and want to chk wether these ar same or not if both ar same then its okie otherwise test fail.what would be the vb script code for it to compare these two values of different page.
Is VB Script Case sensitive or Case insensitive?
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?
What is the use of the instr function?
How to declare an array in vbscript?
i need to sort the data using qtp script for this how i need to write a qtp script
What are the disadvantages of vbscript?
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...
what is the difference between modular and data and keyword driven framework
Which function allows you to instantiate an object given its programmatic identifier or progid?
write a function to read the items from combobox of Flight reservation & save in excel (QTP)??
did any one attended interview in applabs if you had gone through plz tell me the procedure
Mention the environments where vbscript could be run?
How to access array data?