hey i am meant to write a method to display a number of prime numbers specified by the user.
here's my code and i know its prob all wrong and there are much easier ways to do it but i just wanna know what to do to make it compile and i'll work from there.
So far the debugger says "missing return statement"
Any help would be appreciated, thanks.
static boolean loop(int n)
{
int[]a = new int[n];
a[0] = 2;
a[1] = 3;
System.out.print(a[0]);
System.out.print(" ");
System.out.print(a[1]);
System.out.print(" ");
for(int i = 2; i < Math.sqrt(n); i ++)
{
if(a[i] % i == 0)
{
System.out.print(a[i]);
System.out.print(" ");
}
}
System.out.println();
}