Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace _23_Prime_Checker
- {
- class PrimeChecker
- {
- static void Main(string[] args)
- {
- long num = long.Parse(Console.ReadLine());
- Console.WriteLine(IsPrime(num));
- } // End of Main
- public static bool IsPrime(long n)
- {
- bool checkPrime;
- if (n<2)
- {
- checkPrime = false;
- }
- else
- {
- checkPrime = true;
- for (long i = 2; i < n; i++)
- {
- if (n%i==0)
- {
- checkPrime = false;
- break;
- }
- }
- }
- return checkPrime;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement