Friday, September 26, 2008

PRIME NUMBERS

class prime
{

public static void main(String args[]) throws IOException
{
System.out.println("Prime Numbers from 1 to 100");
BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
System.out.print("Enter the primes upper bound ===>> ");
final int MAX = Integer.parseInt(input.readLine());
boolean primes[] = new boolean[MAX];
computePrimes(primes);
displayPrimes(primes);
}


OUTPUT:1 3 5 7 11 13 17 19 23 29 31 37 41 43 47 53 59 61 67 71 73 79 83 89 97.

No comments: