Hi to all.

I learn java with some book and i tried to creat an algorithm that show the prime numbers form 1 to 100.

The principle beahind it was that prime numbers can be divided by themself and 1 only - so the sum of the numbers that can be divided by is - the number himself plus 1.

For example - 5 can be divided by 1 and 5 - so the sum of the dividers is 6...

So this is the algorithm i created, and its say only 3 by the println..

What is the problem please help me guys

import java.util.Scanner; class Primery1 { static Scanner reader = new Scanner(System.in); public static void main(String[] args) { int n, i, c ,sum =0; for (i=2; i<=100; i++) { for (n=1; n<=i; n++) {if ((i%n) == 0) sum=n+sum; } c=i+1; if (sum == c) System.out.println(i);} } }