Important alert: (current site time 5/24/2013 5:36:27 AM EDT) Brand new: recommended reading for every programming language on the site | revamped discussion board | 7 Source Code CDs

# Prime number

Email
 Submitted on: 4/24/2012 10:24:42 AM By: AhmedNassar Level: Beginner User Rating: Unrated Compatibility: Java (JDK 1.4), Java (JDK 1.5) Views: 1231

determine the prime number

code:
Can't Copy and Paste this?
Click here for a copy-and-paste friendly version of this code!
 Terms of Agreement:    By using this code, you agree to the following terms...    You may use this code in your own programs (and may compile it into a program and distribute it in compiled format for languages that allow it) freely and with no charge. You MAY NOT redistribute this code (for example to a web site) without written permission from the original author. Failure to do so is a violation of copyright laws.    You may link to this code from another website, but ONLY if it is not wrapped in a frame.  You will abide by any additional copyright restrictions which the author may have placed in the code or code's description. ``` //************************************** // Name: Prime number // Description:determine the prime number // By: AhmedNassar // //This code is copyrighted and has// limited warranties.Please see http://www.Planet-Source-Code.com/vb/scripts/ShowCode.asp?txtCodeId=7021&lngWId=2//for details.//************************************** import java.io.*; import java.util.Scanner; public class PrimeNumber{ public static void main(String[] args) { Scanner input = new Scanner(System.in); System.out.println("enter number"); int num = input.nextInt(); int i; for (i=2; i < num ;i++ ){ if (num%i ==0){ System.out.println("not Prime!"); break; } } if(i == num){ System.out.println("Prime number!"); }else if (num == 1) { System.out.println("Prime number!"); } } }```

Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

What do you think of this code (in the Beginner category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)