Prime Numbers till user defined
Number
// Prime Numbers till user defined Number
Console.WriteLine("Enter a number to print prime number till");
int b = int.Parse(Console.ReadLine());
Console.WriteLine("2");
for (int a = 3; a <= b; a++)
{
for (int i = 2; i <= a; i++)
{
if (a % i == 0)
{
Console.Write("");
break;
}
if (i > a / 2)
{
Console.WriteLine(a);
break;
}
}
}
Console.ReadLine();