import java.util.*;
import java.lang.Math;
public class Prime {
public static void main(String[] args)
{
for (int i = 1; i < 1500; i++)
if (isPrime(i))
System.out.println(i);
}
public static boolean isPrime(int n)
{
for (int i = 2; i <= Math.sqrt(n); i++)
{
if (n % i == 0)
return false;
}
return true;
}
}
Thursday, February 28, 2008
Sample Code On Prime
Labels:
programming
Subscribe to:
Post Comments (Atom)
Archives
-
▼
2008
(35)
-
▼
February
(35)
- How To Make http To https Request
- User With Password Never Expires on MS-Adam
- Sample Code On Use XML in Java to Write Save Docum...
- Sample Code On Random Sentence Generator
- Sample Code On How To Send Email Using Java Mail
- Keeping a Standard Coding Template
- Sample Code On How to Upload a File and How to Sto...
- Sample Code On Example Uses Of Calendar Class
- Sample Code On How to Get the Start Date of the We...
- How to Make a Java Class Immutable
- Simple Program for Reading Writing Content From File
- Code for Java-Mail
- Sample Code On Simple Date Validation
- Sample Code On Cows and Bulls Game
- Sample Code On BasicDateFormatting.java
- Sample Code On TTSTest.java
- Sample Code On Process Execution
- Sample Code On Read Contents Of URL
- Sample Code On XMLParserUtils
- Sample Code On Bin.java
- Sample Code On ASCII_code
- Sample Code On Prime
- Sample Code On Factorial
- A Serializable JButton
- A Java Calculator
- The example draws several moving wadges on a circle
- Demonstrate Boolean Values
- StackDemo shows how to use the linear set of objects
- Hide Password From Command Line
- Input through Keyboard
- Assertion in Java
- String in Java
- Variable and Expressions
- A Simple HelloWorld.java program
- History of Java
-
▼
February
(35)
thank u
ReplyDelete