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 / anwar basha

n=cint(inputbox("enter the number"))
if n=0 then
msgbox " invalid no"
end if

flag=0
for i=1 to n-1
if n mod i =0 then
falg=1
end if
exit for
next

if falg=1 then
msgbox "not a prime num"
else
msgbox "prime no"
end if

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

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

1758


Mention what is byref and byval parameters in vbscript?

579


Which object is used to work with the database in the vbscript language and what statement is used to create this object?

513


How will you reverse a string in vbscript?

622


What is dictionary object in vbscript? Explain?

628






How to delete a cookie using vbscript?

555


How to assign a numeric value to a variable?

625


What are the valid scopes of a variable in vbscript?

610


when we use filter funtiom invb script(QTP)

2304


When does ‘on click of button’ event gets triggered in the vbscript language?

552


What is loose binding? Why is it not a good practice to use it?

635


What are the disadvantages of vbscript?

657


What is the purpose of regexp object in vbscript?

559


Mention how to access array data?

515


Which in-built function is used to format the number in the vbscript language?

581