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 _06.PrimeChecker
- {
- class Program
- {
- static void Main(string[] args)
- {
- long a = long.Parse(Console.ReadLine());
- if (IsPrime(a))
- {
- Console.WriteLine("True");
- }
- else
- {
- Console.WriteLine("False");
- }
- }
- static bool IsPrime(long a)
- {
- if (a == 0 || a == 1)
- {
- return false;
- }
- for (int i = 2; i <= a/2; i++)
- {
- if(a%i==0)
- return false;
- }
- return true;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement