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 / venkat

n=inputbox("enter the number")
count=0
for i= 1 to n
if n mod i=o Then
count=count+1
Endif
Next
if count=2 Then
Msgbox "number is prime"
Else
Msgbox "number is not prime"
Endif

Is This Answer Correct ?    6 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are the 2 ways to pass a value to the function?

524


How to replace junk code recorded by QTP with a mall function.

1650


How should i Create Email invite with server-side Coding?

1607


Explain How do you create a recordset object in vbscript?

569


Which operator is used to perform the comparison among 2 operands in the vbscript language?

533






How to get the length of the string by making use of the string function?

574


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 in configuration or <%@ Page EnableEventValidation="true" %> in a page. For security purposes, this feature verifies that arguments to postback or callback events originate from the server control that originally rendered them. If the data is valid and expected, use the ClientScriptManager.RegisterForEventValidation method in order to register the postback or callback data for validation." this is my code : <%@ Page Language="VB" Debug="false" %> <%@ import Namespace="Sytem.Data" %> <%@ import Namespace="System.Data.OleDB" %>

(Search Based On Staff I.C No) IC.No (XXXXXX-XX-XXXX)   ' runat="server"> ' runat="server"> ' runat="server"> ' runat="server"> ' runat="server"> ' runat="server"> ' runat="server"> ' runat="server"> ' runat="server"> ' runat="server"> ' runat="server"> ' runat="server"> ' runat="server"> ' runat="server"> ' runat="server"> Total Leave Taken : Days

2351


How to make professional test report using vbscript code in UFT, which gives us complete analysis of the test.

2505


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?

2029


What are keywords in the vbscript language?

530


What are the environments supported by vbscript language?

509


How are values assigned to string type and numeric type variables?

543


Which loop is used in case of arrays in the vbscript language?

528


Mention what is the difference between vbscript and vba?

530


How you can call vbscript functions?

583