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

HCI, I have an assignment In HCI , can anyone help me ?

I have an assignment In HCI , can anyone help me ?

Kitchen mock, How to pull ordered menu from a cash till to database or disp...

How to pull ordered menu from a cash till to database or display on a computer screen

Do while loop statement, Do While Loop Statement : The statements conta...

Do While Loop Statement : The statements contained by the do...while loop block executes till the condition given in the while is true. The working of do...loop is elaborate

Creating an order entry and editing application , Assume you are creating a...

Assume you are creating an order entry and editing application for a book store. An order consists of a product, quantity, total price, payment type including Credit/Debit card acc

Adding handlers with class wizard, Adding Handlers With Class Wizard: ...

Adding Handlers With Class Wizard: Whenever a handler is added, the class wizard places the prototype for the message handler in the header (.H) file. It gives a skeleton hand

Retrieval methods - document in visual programming, Retrieval Methods: ...

Retrieval Methods: There are 3 ways to find a document. The primary method is a positional retrieval. This is achieved by keeping in mind where you left it. The next method is

Vbscript operators, VBScript Operators VBScript contain a full range of...

VBScript Operators VBScript contain a full range of operators, including comparison operators, arithmetic operators, concatenation operators, and logical operators.

Files in a sdi and mdi application, Files in a SDI and MDI Application: ...

Files in a SDI and MDI Application: Both the SDI and MDI projects have 4 implementation files (.cpp extension). These are the files equivalent to the Document Class, View Clas

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?

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