It's about finding the prime numbers from 2 to 1000 using this method but I can't get the solution and I've been thinking and trying to solve this issue for three days. I'm desperate for help so if anyone can help me I would really appreciate it
I tried another for loop and an if statement since my teacher said that I only need another loop or just one more code line but I can't seem to get the solution. I'm really bad at this so I'm sorry if my code seems cringeworthy
public class Practica {
public static void main(String []
byte []marcado = new byte [1000];
for (int i = 2; i < 1000; i++);
if (marcado[i] == 1) {
for (int j = 2; i*j < 1000; j++) {
marcado [i*j] = 0;
}
}
I expect to have all the prime numbers printed