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 _34.PrimeChecker
- {
- class Program
- {
- static void Main(string[] args)
- {
- long n = long.Parse(Console.ReadLine());
- bool isPrime = n>1;
- double limit = Math.Sqrt(n);
- for (int i = 2; i <= limit; i++)
- {
- if (n % i == 0)
- {
- isPrime = false;
- break;
- }
- }
- if (isPrime)
- {
- Console.WriteLine(true);
- }
- else
- {
- Console.WriteLine(false);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement