using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Prime2
{
class CheckPrime
{
//Return true If x is Prime
#region IsPrimebooleanLogic
public bool IsPrime(int x)
{
for (int i = 2; i <= x / i; i++)
{
if ((x % i) == 0)
{
return false;
}
else
return true;
}
}
#endregion
}
class CheckPrimeDemo
{
static void Main(string[] args)
{
CheckPrime opt = new CheckPrime();
int end;
Console.WriteLine("Enter the Ending Number for Prime number search");
end = int.Parse(Console.ReadLine());
for (int i = 1; i < 10; i++)
{
if (opt.IsPrime(i))
Console.WriteLine(i+ " is Prime Number");
else
Console.WriteLine(i + " is Not Prime Number");
}
}
}
}