Generation

generate functionTue, 02 May 2023

estructura para saber cuales numeros son primos

static void Main(string[] args) { Console.WriteLine("Cuantos numeros desea analizar"); int numero = int.Parse(Console.ReadLine()); int[] lista = new int[numero]; int a = 1; int b = 1; for (int i = 0; i < numero; i++) { Console.WriteLine("Pon el numero " + a); a = a + 1; lista[i] = int.Parse(Console.ReadLine()); } for (int j = 0; j < numero; j++) { if (lista[j] % 2 == 0 || lista[j] == 1) { Console.WriteLine("El numero " + b + " no es primo"); } else { Console.WriteLine("El numero " + b + " es primo"); } b= b + 1; } Console.ReadKey

Want to kickstart your project?Use the new AI Studio to create your code