Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace FastPrimeCheckerRefactor
- {
- class MainClass
- {
- public static void Main(string[] args)
- {
- int n = int.Parse(Console.ReadLine());
- for (int i = 2; i <= n; i++)
- {
- bool isPrime = true;
- for (int divisor = 2; divisor <= Math.Sqrt(i); divisor++)
- {
- if (i % divisor == 0)
- {
- isPrime = false;
- break;
- }
- }
- Console.WriteLine($"{i} -> {isPrime}");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement