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