Prog 106: Finding Prime
///Name: Ilana Levy
///Period: 5
///Program Name: Finding Prime Numbers
///File Name: findPrime.java
///Date Finished: 10/10/2015
public class findPrime
{
public static void main( String[] args )
{
for ( int x = 2; x < 21; x++ )
{
boolean prime = isPrime(x);
if ( prime == true )
System.out.println( x + "<" );
else
System.out.println(x);
}
}
public static boolean isPrime( int n )
{
boolean i = true;
int j = 2;
while ( i == true && j < n )
{
if ( n%j == 0 )
i = false;
j++;
}
return i;
}
}