-
Notifications
You must be signed in to change notification settings - Fork 37
/
Copy pathProgram.cs
55 lines (50 loc) · 1.35 KB
/
Program.cs
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace GitHubTestProject
{
public class Program
{
static void Main(string[] args)
{
Console.WriteLine("Hello Github!");
Console.WriteLine("Please complete the following functions and initate a pull request.");
}
/// <summary>
/// Tests if a given number is a prime
/// </summary>
/// <param name="n"></param>
/// <returns></returns>
public static bool IsPrime(int n)
{
bool Is = true;
for (int i = 2; i < Math.Sqrt(n); i++)
{
if (n % i == 0)
Is = false;
}
return Is;
}
/// <summary>
/// Sorts a given integer array
/// </summary>
/// <param name="a">An integer array</param>
public static void Sort(int[] a)
{
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;
}
}
}
}
}
}