Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Linq;
- namespace ConsoleApp5
- {
- class Program
- {
- static void Main(string[] args)
- {
- int input = int.Parse(Console.ReadLine());
- string arrString = "";
- for (int i = 2; i <= input; i++)
- {
- bool isPrime = true;
- for (int j = 2; j <= Math.Sqrt(i); j++)
- {
- if (i % j == 0)
- {
- isPrime = false;
- }
- }
- if (isPrime)
- {
- arrString += i + " ";
- }
- }
- int[] arr = arrString.Split(' ').Select(int.Parse).ToArray();
- Console.WriteLine(string.Join(" ", arrString));
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement