aggressiveviking

Untitled

Mar 5th, 2020
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.27 KB | None | 0 0
  1. using System;
  2.  
  3. namespace _06.LettersCombinations
  4. {
  5.     class LettersCombinations
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             char begin = char.Parse(Console.ReadLine());
  10.             char end = char.Parse(Console.ReadLine());
  11.             char exclude = char.Parse(Console.ReadLine());
  12.             int count = 0;
  13.  
  14.             for (int firstLetter = begin; firstLetter <= end; firstLetter++)
  15.             {
  16.                 if (firstLetter != exclude)
  17.                 {
  18.                     for (int secondLetter = begin; secondLetter <= end; secondLetter++)
  19.                     {
  20.                         if (secondLetter != exclude)
  21.                         {
  22.                             for (int thirdLetter = begin; thirdLetter <= end; thirdLetter++)
  23.                             {
  24.                                 if (thirdLetter != exclude)
  25.                                 {
  26.                                     Console.Write($"{(char)firstLetter}{(char)secondLetter}{(char)thirdLetter} ");
  27.                                     count++;
  28.                                 }
  29.  
  30.                             }
  31.                         }
  32.  
  33.                     }
  34.                 }
  35.  
  36.             }
  37.             Console.WriteLine(count);
  38.         }
  39.     }
  40. }
Advertisement
Add Comment
Please, Sign In to add comment