0
0

More than 3 years have passed since last update.

DNAの記号をランダムに表示

Posted at

public class Main {
public static void main(String[] args) {
int [] seq = new int [10];
//配列をランダムに生成
for (int i = 0; i < seq.length; i++) {
seq[i] = new java.util.Random().nextInt(4);
}
//記号を表示
for (int i = 0; i < seq.length; i++) {
switch (seq[i]) {
case 0:
System.out.print("A");
break;
case 1:
System.out.print("T");
break;
case 2:
System.out.print("G");
break;
case 3:
System.out.print("C");
break;
}
}
}
}

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0