From 1fc18efedc433cec8500b09361602959e6494831 Mon Sep 17 00:00:00 2001 From: mattaranya <USER1@DOMAIN.local> Date: Mon, 12 Sep 2016 14:39:49 +0300 Subject: [PATCH 1/2] Does Epic Shit --- GitHubTestProject/Program.cs | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/GitHubTestProject/Program.cs b/GitHubTestProject/Program.cs index b910941..cab17bf 100644 --- a/GitHubTestProject/Program.cs +++ b/GitHubTestProject/Program.cs @@ -20,8 +20,13 @@ static void Main(string[] args) /// <returns></returns> public static bool IsPrime(int n) { - // TODO: Complete fhe funtion - return n % 2 != 0; + bool Is = false; + for (int i = 0; i < Math.Sqrt(n); i++) + { + if (n % i == 0) + Is = true; + } + return Is; } /// <summary> @@ -30,7 +35,21 @@ public static bool IsPrime(int n) /// <param name="a">An integer array</param> public static void Sort(int[] a) { - // TODO: Complete fhe funtion + int help = 0; + for (int i = 0; i < a.Length-1; i++) + { + for (int j = i+1; j < a.Length; j++) + { + if (a[i] > a[j]) + { + help = a[i]; + a[i] = a[j]; + a[j] = help; + } + + } + } } + } } From 6a69ee8d9af4a1cdc8d22abb595e0d6310853103 Mon Sep 17 00:00:00 2001 From: mattaranya <USER1@DOMAIN.local> Date: Mon, 12 Sep 2016 14:42:34 +0300 Subject: [PATCH 2/2] toms fixed my code --- GitHubTestProject/Program.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/GitHubTestProject/Program.cs b/GitHubTestProject/Program.cs index cab17bf..85093be 100644 --- a/GitHubTestProject/Program.cs +++ b/GitHubTestProject/Program.cs @@ -20,11 +20,11 @@ static void Main(string[] args) /// <returns></returns> public static bool IsPrime(int n) { - bool Is = false; - for (int i = 0; i < Math.Sqrt(n); i++) + bool Is = true; + for (int i = 2; i < Math.Sqrt(n); i++) { if (n % i == 0) - Is = true; + Is = false; } return Is; }