class Program
{
static void Main(string[] args)
{
int i, j, count, min, max;
Console.WriteLine("Enter the minimum value");
min = int.Parse(Console.ReadLine());
Console.WriteLine("Enter the maximum number");
max = int.Parse(Console.ReadLine());
if (min == 0)
min = min + 1;
Console.WriteLine("Prime number between min and max {0},{1}", min, max);
for (i = min; i <= max; i++)
{
count = 0;
for (j = 2; j <= i / 2; j++)
{
if (i % j == 0)
{
count++;
break;
}
}
if (count == 0 && i != 1)
Console.Write(i + " ");
}
Console.ReadLine();
}
}
No comments:
Post a Comment