CSharp · Console
using System;
public class Program
{
public static bool ePrimo(int num){
int div = 0;
for (int i = 1; i <= num; i++)
{
if (num % i == 0)
{
div++;
}
}
return div == 2;
}
public static void Main()
{
Random r = new Random();
int p = r.Next(1, 100);
while (!ePrimo(p))
{
p = r.Next(1,100);
}
Console.WriteLine(p);
}
}