C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Communities   Interview   Jobs   Projects   Offshore Development    
Silverlight Tutorials | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Revenue Sharing |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...

New Feature: Community Sites: Create your own .NET community website and start earning from Google AdSense ! It's Free !




Check whether Number is prime or not


Posted Date: 20 Mar 2007    Resource Type: Code Snippets    Category: Numeric

Posted By: Madhura       Member Level: Silver
Rating:     Points: 10



Check whether the number (Passed in Textbox1) is prime or not


Dim x As Integer
Dim i As Integer
Dim Flag As Boolean = False

x = TextBox1.Text
For i = 2 To x / 2
If (i = x) Then i = i + 1
If (x Mod i = 0) Then
Flag = True
Exit For
End If
Next

If (Flag = False) Then
' this num is prime number
MsgBox("PRIME")
Else
' this num is not prime number
MsgBox("NOT PRIME")
End If




Responses

Author: mukesh chauhan    12 May 2008Member Level: Gold   Points : 2
good


Feedbacks      
Popular Tags   What are tags ?   Search Tags  
(No tags found.)

Post Feedback


This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
You must Sign In to post a response.
Previous Resource: Unique random numbers based on GUID
Return to Discussion Resource Index
Post New Resource
Category: Numeric


Post resources and earn money!
 
Related Resources



dotNet Slackers   BizTalk Adaptors    Web Design

internet fax

Contact Us    Privacy Policy    Terms Of Use