Assignemnt #106

Code

//colin hinton
//5th period
//Prime.java
//2/29/2016

public class Prime
{
    public static void main(String[] args)
    {
        for (int x = 2; x <= 100; x = x + 1)
        {
            if (isPrime(x) == true)
            {
                System.out.print(x);
                System.out.println();
            }
        }
    }
    public static boolean isPrime(int n)
    {
        int divis = 0;
        for (int m = 2; m < n; m = m + 1)
        {
            if (n%m == 0)
            {
                divis ++;
            }
        }
        if (divis == 0)
            return true;
        else
            return false;
        
    }
} 
    

Picture of the output

Assignment 1