imprimir los números primos del 0 al 100
public static void Main(string[] args) { int[] arr = new int[100]; for (int i = 2; i < arr.Length; i++) { arr[i] = i; } for (int i = 2; i < arr.Length; i++) { if (arr[i] == 0) continue; for (int j = 2; j < arr.Length; j++) { if (i * j < arr.Length) arr[i * j] = 0; else break; } } for (int i = 2; i < arr.Length; i++) { if (arr[i] != 0) Console.WriteLine(arr[i]); } }