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

Do until loop statement , Do Until Loop Statement: The statements with...

Do Until Loop Statement: The statements within the do...until loop block executes till the condition given in until become true. The working of do...until loop is elaborated w

Lotto, You are asked to create the LOTO game customized according to the fo...

You are asked to create the LOTO game customized according to the following constraints: 1. Create a grid containing 20 numbers (20 buttons: button1, button2, …button20) 2. When t

Visual interface design, VISUAL INTERFACE DESIGN Instead of the graphic...

VISUAL INTERFACE DESIGN Instead of the graphic nature of the program, only the visualness of the inter action is important. The program must not focus on the GUI. On the other

Message box - dialog box in visual basic, Message Box: The Message Box...

Message Box: The Message Box can be specified a title as shown in figure to specify the title for the message box follow by the command given below:  Private Sub Command1_C

Program for add integers from 1-1000, Using Visual Studio 2010 C++ 1) U...

Using Visual Studio 2010 C++ 1) Using Windows Explorer, make a copy of Irvine\examples\Project_sample folder in the folder where you keep your materials for this course.

Application Deployment , I would like to know how to deploy a VB.NET Applic...

I would like to know how to deploy a VB.NET Application using SQL SERVER as a back-end database

Deleting records - data control, Deleting Records: To remove a record ...

Deleting Records: To remove a record use the Delete method. To delete the record from the customer table follow the coding as shown below: data1.RecordSource = "Customer"

Mr, want a visual basic code on Hungarian method

want a visual basic code on Hungarian method

While loop - vbscript, In VBScript, the While...Wend statement is provided ...

In VBScript, the While...Wend statement is provided for those who are familiar along its usage. However, due to the lack of flexibility in While...Wend, it is suggested that you us

Intrinsic controls, INTRINSIC CONTROLS   The Intrinsic controls are th...

INTRINSIC CONTROLS   The Intrinsic controls are the built-in controls. Few of the controls are Combo box, Check box, Command Button, Label etc. The controls have properties re

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