Check prime number using vb script, Visual Basic Programming

Assignment Help:

<HTML>

       <HEAD>

<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">

<TITLE></TITLE>

<SCRIPT LANGUAGE=vbscript>

<!--

Function IsPrime(str)

str=trim(str) Dim bln,ctr bln=true ctr=1

if(cint(str)<1)then

IsPrime=false exit function end if

if(cint(str)=1 or cint(str)=2 or cint(str)=3)then

IsPrime=true exit function end if

for ctr=cint(str)-1 to 2 step -1 if(cint(str)mod(ctr)=0)then

bln=false end if next

IsPrime=bln

End Function

Function IsEven(str) str=trim(str) if(str="0")then IsEven=true

exit function

end if if(cint(str)mod(2)=0)then IsEven=true

else IsEven=false end if

End Function

Sub mysub()

str=text1.value

if not(isnumeric(str))then msgbox "Not numeric value" exit sub

end if

if(rad(0).checked)then if(IsEven(str))then msgbox "Yes this is even" else

msgbox "No it is not " end if

Exit sub

end if

if(rad(1).checked)then if(IsEven(str))then

msgbox "No it is not odd number"

else

msgbox "Yes it is odd number" end if

Exit sub end if

if(rad(2).checked)then if(IsPrime(str))then

msgbox "Yes it is prime number"

else

msgbox "No it is not a prime number" end if

Exit sub end if

End Sub

//-->

</SCRIPT>

</HEAD>

<BODY>

<P> Even

<INPUT type=radio name="rad" checked value="even"> Odd

<INPUT type=radio name="rad" value="odd"> Prime

<INPUT type=radio name="rad" value="prime">

</P>

<P><INPUT id=text1 name=text1></P>

<P><INPUT id=button1 type=button value=Button name=button1

LANGUAGE=javascript onclick="mysub()"></P>

</BODY>

</HTML>


Related Discussions:- Check prime number using vb script

Match Game, I would like someone to look at my code and tell me why it''s n...

I would like someone to look at my code and tell me why it''s not working

Use serialize function in document class to implement file, USE OF SERIALIZ...

USE OF SERIALIZE FUNCTION IN DOCUMENT CLASS TO IMPLEMENT FILE void CStoreDoc::Serialize(CArchive& ar) { if (ar.IsStoring()) { // TODO: add storing code here }

Drawing, #questiontypes of lines and how to draw

#questiontypes of lines and how to draw

Windows 32 bit (win 32) applications, WINDOWS 32 BIT (WIN 32) APPLICATIONS ...

WINDOWS 32 BIT (WIN 32) APPLICATIONS   The Win 32 based applications are the applications developed for the windows family of the operating systems. The Win 32 applications ac

Dynamic link library - dll , DYNAMIC LINK LIBRARY - DLL   The DLL are ...

DYNAMIC LINK LIBRARY - DLL   The DLL are files which can be called when required by the other program that is running in the computer. The DLL files which support the specific

Odbc, ODBC   The ODBC gives an API which distinguishes the data base v...

ODBC   The ODBC gives an API which distinguishes the data base vendors implementation via the ODBC drivers specific to a DBMS. The program will use the API to call the ODBC dr

Explain class module and standard module, Difference between Class Module a...

Difference between Class Module and Standard Module? Standard module: -This place for variable declarations,procedures etc.& it can accessed these procedures in whereve

Record set - database applications, Record Set: The record set present...

Record Set: The record set presents the records in a base table or the records retrieved due to the query. The record set falls into 3 classes. These are table type record set

Vbscript variables, A variable is convenient placeholder which refers to a ...

A variable is convenient placeholder which refers to a computer memory location where you can store program information which may change when your script is running. For instance,

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd