Skip to content

Instantly share code, notes, and snippets.

@godie007
Created May 3, 2012 20:18
Show Gist options
  • Select an option

  • Save godie007/2588981 to your computer and use it in GitHub Desktop.

Select an option

Save godie007/2588981 to your computer and use it in GitHub Desktop.
Mire
package Empresa;
public class NumPrimo {
public static void main(String[] args) {
System.out.println("1");
for (int i = 1; i <= 100; i++) {
int contador = 0;
for (int j = 1; j <= i; j++) {
if (i % j == 0)
contador++;
}
if (contador == 2)
System.out.println(i);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment