All pastes #271214 Raw Edit

Anonymous

public text v1 · immutable
·published 2006-12-08 02:48 UTC
rendered paste body
import java.io.*;

public class PrimeNumbers {
	public static void main(String[] args) throws IOException {
		BufferedReader consoleInput = new BufferedReader(new InputStreamReader(System.in));
		
		System.out.print("Please enter an integer: ");
		int input = Integer.parseInt(consoleInput.readLine());
		
		int count = 0;
		
		for (int i = 2; i <= input; i++) {
			for (int q = 1; q < i; q++) {
				if ((i % q) != 0) {
					count++;
				}
				if (count == (i-2)) {
					System.out.println(i);
				}
			}
			count = 0;
		}
	}
}