-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdna.cs
More file actions
49 lines (39 loc) · 1.01 KB
/
Copy pathdna.cs
File metadata and controls
49 lines (39 loc) · 1.01 KB
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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace codeWarsDna
{
class Program
{
static void Main(string[] args)
{
}
}
public class DnaStrand
{
public static string MakeComplement(string dna)
{
List<char> charList = new List<char>();
charList.AddRange(dna);
string opposite = null;
for (int i = 0; i < charList.Count; i++)
{
if (charList[i] == 'T')
charList[i] = 'A';
else if (charList[i] == 'A')
charList[i] = 'T';
else if (charList[i] == 'C')
charList[i] = 'G';
else if (charList[i] == 'G')
charList[i] = 'C';
}
foreach (var item in charList)
{
opposite += item;
}
return opposite;
}
}
}