Advertisement
Guest User

06.DNA_Sequences

a guest
May 27th, 2017
544
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.74 KB | None | 0 0
  1. sing System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace _06.DNA_Sequences
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             var matchSum = int.Parse(Console.ReadLine());
  14.             var checkSum = 0;
  15.             var rowCount = 0;
  16.             var str = string.Empty;
  17.            
  18.             Char[] nucleicAcid = {'A', 'C', 'G', 'T'};
  19.             int[] nucleicAcidValue = { 1, 2, 3, 4 };
  20.  
  21.             for (int i = 0; i < 4; i++)
  22.             {
  23.                 for (int j = 0; j < 4; j++)
  24.                 {
  25.                     for (int k = 0; k < 4; k++)
  26.                     {
  27.                         //var str = "" + nucleicAcid[i] + nucleicAcid[j] + nucleicAcid[k] + " ";
  28.                         //Console.Write(str);
  29.                         checkSum = nucleicAcidValue[i] + nucleicAcidValue[j] + nucleicAcidValue[k];
  30.  
  31.                         if (checkSum >= matchSum)
  32.                         {
  33.                             str = "O" + nucleicAcid[i] + nucleicAcid[j] + nucleicAcid[k] + "O" + " ";
  34.                         }
  35.                         else
  36.                         {
  37.                             str = "X" + nucleicAcid[i] + nucleicAcid[j] + nucleicAcid[k] + "X" + " ";
  38.                         }
  39.                         Console.Write(str);
  40.                         rowCount++;
  41.                         if (rowCount >= 4)
  42.                         {
  43.                             Console.WriteLine();
  44.                             rowCount = 0;
  45.                         }                            
  46.                     }
  47.                 }
  48.             }
  49.             //Console.WriteLine();            
  50.         }
  51.     }
  52. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement