Hello everyone i need help with a prime number program i'm getting a small error and don't know how to solve it
Here's the error i keep getting// File: Prime.java | // ------------------------------------------------------------------------+ // Author: Shane Lowry Group: Group 1 | // Student# B00059978 Date: 13/11/2012 | // ------------------------------------------------------------------------+ // Problem Set 2: Problem 9 | // | // DESCRIPTION: | // Input a number and output if is a prime number is equal to 1. | // | // | // ------------------------------------------------------------------------+ import java.io.*; import java.util.*; public class Prime { public static void main(String[] args)throws IOException { // Set up an input buffer for reading input values BufferedReader input = new BufferedReader(new InputStreamReader(System.in)); int i; // Set up an output buffer for writing results to PrintWriter output = new PrintWriter(System.out); // Read in input values String line1 = input.readLine(); // Convert string into binary int x = Integer.parseInt(line1); // Output input values output.println("Prime Number: "); for(i=1; i<x; i++){ int j; for(j=2;j<i; j++){ int n = i%j; if(n==0) break; } } if(i == j){ output.println(" "+i);} // clean up output buffer output.flush(); } }
C:\Users\shane\Documents\Algorithem\Week 2 Problems\Prime.java:44: error: cannot find symbol
if(i == j){
^
symbol: variable j
location: class Prime
1 error