Find and correct mistakes.

Find and correct all mistakes in the following program. It should work according to the comments.


public class FindMistakes {
	public static void main(String [] args) {
		int n = 12682;
		System.out.println(n " is divisible by the following:");
		// The loop prints out all the factors of n
		for (i = 0; i <= n; ++i;) {
			if (n % i = 0) {
				System.println(i);	
			}
		}
		
	}
}

CSci 2101 course web site.

The views and opinions expressed in this page are strictly those of the page author. The contents of this page have not been reviewed or approved by the University of Minnesota.