-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDNA_RNA_Encoder.cs
81 lines (58 loc) · 1.72 KB
/
DNA_RNA_Encoder.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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
using System;
class Program {
static void Main(string[] args) {
Console.WriteLine("DNA/RNA"+"\n");
string choice=Console.ReadLine();
switch (choice) {
case "DNA":
string input=Console.ReadLine();
char [] input1=input.ToCharArray();
char [] newInput=new char[input1.Length];
for (int i=0; i<input1.Length; i++) {
char scan=input1[i];
switch (scan) {
case 'A':
newInput[i]='T';
break;
case 'T':
newInput[i]='A';
break;
case 'G':
newInput[i]='C';
break;
case 'C':
newInput[i]='G';
break;
}
}
string finalD=string.Join("", newInput);
Console.WriteLine("\n"+finalD);
break;
case "RNA":
string inpuT=Console.ReadLine();
char [] input2=inpuT.ToCharArray();
char [] newInput1=new char[input2.Length];
for (int i=0; i<input2.Length; i++) {
char scan=input2[i];
switch (scan) {
case 'A':
newInput1[i]='U';
break;
case 'T':
newInput1[i]='A';
break;
case 'G':
newInput1[i]='C';
break;
case 'C':
newInput1[i]='G';
break;
}
}
string finalR=string.Join("", newInput1);
Console.WriteLine("\n"+finalR);
break;
}
Console.ReadKey();
}
}