Advertisement
VladoG

[PB] TEST-Exam 2017-03-11- 06-LettersCombinations

Mar 12th, 2017
225
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.44 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 _06_LettersComb
  8.     {
  9.     class ProgramLettersComb
  10.         {
  11.         static void Main(string[] args)
  12.             {
  13.             char begin = char.Parse(Console.ReadLine());
  14.             char end = char.Parse(Console.ReadLine());
  15.             char exclude = char.Parse(Console.ReadLine());
  16.             int count = 0;
  17.  
  18.             for (int firstLetter = begin; firstLetter <= end; firstLetter++)
  19.                 {
  20.                 if (firstLetter != exclude)
  21.                     {
  22.                     for (int secondLetter = begin; secondLetter <= end; secondLetter++)
  23.                         {
  24.                         if (secondLetter != exclude)
  25.                             {
  26.                             for (int thirdLetter = begin; thirdLetter <= end; thirdLetter++)
  27.                                 {
  28.                                 if (thirdLetter != exclude)
  29.                                     {
  30.                                     Console.Write("{0}{1}{2} ", (char)firstLetter, (char)secondLetter, (char)thirdLetter);
  31.                                     count++;
  32.                                     }
  33.  
  34.                                 }
  35.                             }
  36.  
  37.                         }
  38.                     }
  39.  
  40.                 }
  41.             Console.WriteLine(count);
  42.  
  43.             }
  44.         }
  45.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement