Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- class Example
- {
- public static void Main ()
- {
- int n = int.Parse (Console.ReadLine ());
- bool isPrime = true;
- if (n <= 1)
- {
- isPrime = false;
- }
- for (int i = 2; i <= n; i++)
- {
- if (n % i == 0)
- {
- isPrime = false;
- break;
- }
- }
- Console.WriteLine (isPrime ? "Prime" : "Not Prime!");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement