diff --git a/GitHubTestProject/Program.cs b/GitHubTestProject/Program.cs index b910941..407109e 100644 --- a/GitHubTestProject/Program.cs +++ b/GitHubTestProject/Program.cs @@ -20,17 +20,38 @@ static void Main(string[] args) /// public static bool IsPrime(int n) { - // TODO: Complete fhe funtion - return n % 2 != 0; + if (n==2) + return true; + int s = (int)Math.Sqrt(n); + for (int i = 2; i <= s; i++) + { + if (n % i == 0) + return false; + } + return true; + + } /// /// Sorts a given integer array /// - /// An integer array - public static void Sort(int[] a) + /// An integer array + public static void Sort(int[] arr) { - // TODO: Complete fhe funtion + int temp = 0; + for (int write = 0; write < arr.Length; write++) + { + for (int sort = 0; sort < arr.Length - 1; sort++) + { + if (arr[sort] > arr[sort + 1]) + { + temp = arr[sort + 1]; + arr[sort + 1] = arr[sort]; + arr[sort] = temp; + } + } + } } } }