Hilo Photo from Ramdev Kalantri
5 mensajes · –C G
K import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); sc.close(); loop: for (int i = 2, c = 0; c < n; i++) { double sqrt = Math.sqrt(i); for (int j = 2; j <= sqrt; j++) { if (i % j == 0) { continue loop; } } System.out.print(i + " "); c++; } } }