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

Hotel management system, i need to do my final project for my last year bsc...

i need to do my final project for my last year bsc honours degree in Business Information systems. I need to develop a system which is operational for hotel management system. th

Displaying the file without scrolling - document class, Displaying the file...

Displaying the file Without Scrolling: To display a file follow the steps as shown below: 1. Generate a SDI application. 2. Type the coding as shown in the Serialize els

Adding events in visual basic , Adding Events in VB   For adding the e...

Adding Events in VB   For adding the events in VB, first double click on the command button with the caption hello. The Private Sub command1_Click () and End Sub would be

The frame - document view architecture, The Frame: As the name suggest...

The Frame: As the name suggests, the frame is a combination of the building blocks, structure and the borders of an item. The frame gives the "physical" presence to a window.

Tab order - dialog, Tab Order: The tab order stands for the order in w...

Tab Order: The tab order stands for the order in which the controls receive focus when the user clicks the tab key. The CTRL + D can be used to set the tab order of controls.

Scalar variables and array variables, Mostly time, you just desire to assig...

Mostly time, you just desire to assign a single value to a variable you have declared. A variable having a single value is a scalar variable. At other times, this is convenient to

Employee data, Part 1: Create an application that allows the user to enter ...

Part 1: Create an application that allows the user to enter the following employee data: First Name, Middle Name, Last Name, Employee Number, Department, Telephone Number, Telephon

Running statements if a condition is true, To run only one statement while ...

To run only one statement while a condition is True, employ the single-line syntax for the If...Then...Else statement. The following instance shows the single-line syntax. Notice t

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

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