/*Ok I have code that's behaving unexpectedly
The following program is supposed to print prime numbers for n1=100,n2=1000,n3=10000 and n4=100000 except that for n1=100, it prints the squares of primes less than 10. I can implement this same program in c++ and wouldn't get such output. I need another pair of eyes to look through my code and tell me if there's anything semantically wrong with it. Thanks */
import java.util.*;
import java.lang.*;
class Rextester
{
public static void main(String args[])
{
int n1=100;int n2=1000;int n3=10000;int n4=100000;
long start = System.nanoTime();
int n=0;
for(int i=2;i<n1;i++){
n=0;
for(int j=2;j<i;j++){
if(i%j==0){
n+=1;}
}
if(n==1)
System.out.println(i);
}
long end = System.nanoTime();
System.out.println("The execution time was: "+(end-start)+" nanoseconds.");
}
}