grach

2016_18_Dec_Letters Combinations

Jul 20th, 2017
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.14 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace LettersCombination
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             var start = char.Parse(Console.ReadLine());
  14.             var end = Console.ReadLine()[0];
  15.             var ignorChar = char.Parse(Console.ReadLine());
  16.  
  17.             var combinations = 0;
  18.  
  19.             for (int i = start; i <= end; i++)  //отпечатваме 1-вата буква
  20.             {
  21.                 for (int j = start; j <= end; j++) // отпечатваме 2-та буква
  22.                 {
  23.                     for (int k = start; k <= end; k++) //  за 3-тата буква
  24.                     {
  25.                         if (i != ignorChar && j != ignorChar && k != ignorChar)
  26.                         {
  27.                             Console.Write("{0}{1}{2} ", (char)i, (char)j, (char)k);
  28.  
  29.                             combinations++;
  30.                         }
  31.                     }
  32.                 }
  33.             }
  34.             Console.WriteLine(combinations);
  35.         }
  36.     }
  37. }
Advertisement
Add Comment
Please, Sign In to add comment