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

Data types - windows programming, Data types: The New data types were ...

Data types: The New data types were defined by using the typedef or #define statements. This was to allow the transition from 16 bit to 32 bit system. Some of the fresh data t

How to include list box control in visual basic project, How to Include Lis...

How to Include List Box control in your project A list box is used for representing the users with a data. You can prefer the data from the list box for data entry. No editing

Visual basic program, Create the flowcharts using MS Visio, MS Excel or MS ...

Create the flowcharts using MS Visio, MS Excel or MS Word to demonstrate the algorithm. Submit your flowchart under the assignment for CH7-4-26 Flowchart. Part Printouts H

Steps to create a rectangle in the client region, STEPS TO CREATE A RECTANG...

STEPS TO CREATE A RECTANGLE IN THE CLIENT REGION 1. Generate a SDI application and name it as a brush. 2. Handle the WM_LBUTTONDOWN message for the CBrushView object id.

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 }

Accelerators - intrinsic control, Accelerators: The Accelerators are s...

Accelerators: The Accelerators are short cut keys. The Accelerators are formed by placing an ampersand before any of the characters of the Caption. As a product the letter fol

Infomation system, what are the things that information system can do and t...

what are the things that information system can do and their limitations?

Control statements, CONTROL STATEMENTS   The conditional expression us...

CONTROL STATEMENTS   The conditional expression uses a comparison operator that results in true or false value. If the comparison is valid the outcome is true, or else the out

Hungarian notation, Hungarian Notation: The Hungarian Notation was inv...

Hungarian Notation: The Hungarian Notation was invented by Charles Simonyi from Microsoft. It is a naming convention. It is a reminder of the type of a variable. The Handles h

Runtime proggramming, i have a database i want mange it network and i want ...

i have a database i want mange it network and i want write it with vb.net so how i can do this

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