Assignment # 106 and Prime Numbers

Code

    /// Name: Tommy Oyuntseren
    /// Period: 7
    /// Program Name: PrimeNumbers
    /// File Name: PrimeNumbers.java
    /// Date: 5/9/16

public class PrimeNumbers
    {
        public static void main(String[] args)
        {
            for (int n=2; n< 21; n++)
            {
                if (isPrime(n))
                    System.out.println(n + " <");
                else
                    System.out.println(n);
            }
        }
        public static boolean isPrime(int n)
        {
            for (int i=2; i< n; i++)
            {
                if ((n % i)== 0)
                    return false;
            }
            
            return true;
        }
    }
    
	
  
    
   

  

Picture of the output

Assignment 106