A prime number (or a prime) is a natural number greater than 1 that has no positive divisors other than 1 and itself.
A natural number greater than 1 that is not a prime number is called a composite number.
using System;
namespace String
{
class Prime
{
static void Main(string[] args)
{
int count = 0;
Console.WriteLine("Enter a num");
int a = Convert.ToInt32(Console.ReadLine());
for (int i = 1; i <= (a / 2); i++)
{
if (a % i == 0)
{
count++;
}
}
if (count == 1)
{
Console.WriteLine(" Prime number");
}
else
{
Console.WriteLine(" Is not Prime number");
}
Console.ReadLine();
}
}
}
