Welcome to mirror list, hosted at ThFree Co, Russian Federation.

test-729.cs « tests « mcs - github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: aaf0463aaa0ebb3ec5d96290b4f398c409421c98 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
using System;

namespace Primes
{
	class MainClass
	{
		public static int Main ()
		{
			const ulong max = 5;
			bool[] numbers = new bool[max];

			for (ulong i = 0; i < max; i++)
				numbers[i] = true;

			for (ulong j = 1; j < max; j++)
				for (ulong k = (j + 1) * 2; k < max; k += j + 1)
					numbers[k] = false;

			for (ulong i = 0; i < max; i++)
				if (numbers[i])
					Console.WriteLine (i + 1);

			return 0;
		}
	}
}