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