Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 26 additions & 5 deletions GitHubTestProject/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,38 @@ static void Main(string[] args)
/// <returns></returns>
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;


}

/// <summary>
/// Sorts a given integer array
/// </summary>
/// <param name="a">An integer array</param>
public static void Sort(int[] a)
/// <param name="arr">An integer array</param>
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;
}
}
}
}
}
}