using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace prime
{
class Program
{
static void Main(string[] args)
{
int n, i,count=0;
Console.WriteLine("Eneter the Number");
n=Convert.ToInt32 (Console.ReadLine ());
for (i = 1; i <= n; i++)
{
if (n % i == 0)
{
count++;
}
}
if (count == 2)
{
Console.WriteLine("The Given Number is prime");
}
else
{
Console.WriteLine("The Given Number is not prime");
}
Console.ReadLine();
}
}
}
No comments:
Post a Comment