using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
int num;
int b = 2;
Console.Write("Enter
the Number: ");
num = int.Parse(Console.ReadLine());
while (b < num)
{
if (num % b == 0)
{
Console.WriteLine("The number is not prime");
break;
}
b++;
}
if (b == num)
Console.WriteLine("The number is prime");
Console.ReadLine();
}
}
}
No comments:
Post a Comment