Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- namespace PrimeChecker
- {
- using System;
- public class StartUp
- {
- public static void Main()
- {
- long n = long.Parse(Console.ReadLine());
- Console.WriteLine(IsPrime(n));
- }
- public static bool IsPrime(long n)
- {
- bool isPrime = true;
- for (long i = 2; i <= Math.Sqrt(n); i++)
- {
- if (n % i == 0 || n <= 1)
- {
- isPrime = false;
- }
- }
- return isPrime;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement