Advertisement
Guest User

Untitled

a guest
Apr 4th, 2018
325
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.94 KB | None | 0 0
  1. using System;
  2.  
  3.  
  4. class LettersCombinations
  5. {
  6.     static void Main(string[] args)
  7.     {
  8.         char start = char.Parse(Console.ReadLine());
  9.         char end = char.Parse(Console.ReadLine());
  10.         char toSkip = char.Parse(Console.ReadLine());
  11.        
  12.         int combinations = 0;
  13.  
  14.         for (char firstLetter = start; firstLetter <= end; firstLetter++)
  15.         {
  16.             for (char secondLetter = start; secondLetter <= end; secondLetter++)
  17.             {
  18.                 for (char thirdLetter = start; thirdLetter <= end; thirdLetter++)
  19.                 {
  20.                     if (firstLetter != toSkip && secondLetter != toSkip && thirdLetter != toSkip)
  21.                     {
  22.                         Console.Write(" {0}{1}{2}", firstLetter, secondLetter, thirdLetter);
  23.                         combinations++;
  24.                     }
  25.                 }
  26.             }
  27.         }
  28.  
  29.         Console.WriteLine(" {0}", combinations);
  30.     }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement