using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApplication33
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Enter a number to find the factorial: ");
int a = Convert.ToInt32(Console.ReadLine());
int dr = 0;
for (int i = 2; i <= a - 1; i++)
{
if (a % i == 0)
{
dr = 1;
break;
}
}
if (dr == 1)
{
Console.WriteLine("Entered number is not prime.");
}
else
{
Console.WriteLine("Entered number is prime.");
}
Console.ReadKey();
}
}
}In this code snippet you will learn to find the entered number is a prime number or not in an easy manner.
