Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Numerics;
- public class CheckPrimeNumber
- {
- static void Main()
- {
- BigInteger n = BigInteger.Parse(Console.ReadLine());
- if (n < 2)
- {
- Console.WriteLine("Not Prime");
- return;
- }
- for (long i = 2; i < (long)Math.Floor(Math.Sqrt(double.Parse(n.ToString()))); i++)
- {
- if (n % i == 0)
- {
- Console.WriteLine("Not Prime");
- return;
- }
- }
- Console.WriteLine("Prime");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement