madeofglass

Untitled

Feb 16th, 2020
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.93 KB | None | 0 0
  1. using System;
  2.  
  3. namespace _02._LettersCombinations
  4. {
  5.     class LettersCombinations
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             char first = char.Parse(Console.ReadLine());
  10.             char second = char.Parse(Console.ReadLine());
  11.             char third = char.Parse(Console.ReadLine());
  12.            
  13.             var combinations = 0;
  14.  
  15.             for (char i = first; i <= second; i++)
  16.             {
  17.                 for (char j = first; j <= second; j++)
  18.                 {
  19.                     for (char k = first; k <= second; k++)
  20.                     {
  21.                         if (i != third && j != third && k != third)
  22.                         {
  23.                             Console.Write($"{i}{j}{k} ");
  24.                             combinations++;
  25.                         }
  26.                     }
  27.                 }
  28.             }
  29.  
  30.             Console.WriteLine(combinations);
  31.         }
  32.     }
  33. }
Advertisement
Add Comment
Please, Sign In to add comment