VelizarAvramov

14. Magic Letter

Nov 5th, 2018
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.01 KB | None | 0 0
  1. using System;
  2.  
  3. namespace _14._Magic_Letter
  4. {
  5.     class MagicLetter
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             //Write a program, which prints all 3-letter combinations, using only the letters from a given interval. You will also
  10.             //receive a third letter. Every combination, which contains this letter should not be printed.
  11.             char first = char.Parse(Console.ReadLine());
  12.             char second = char.Parse(Console.ReadLine());
  13.             char third = char.Parse(Console.ReadLine());
  14.  
  15.             for (char i = first; i <= second; i++)
  16.             {
  17.                 for (char k = first; k <= second; k++)
  18.                 {
  19.                     for (char j = first; j <= second; j++)
  20.                     {
  21.                         if (i != third && k != third && j != third)
  22.                         {
  23.                             Console.Write($"{i}{k}{j} ");
  24.                         }
  25.                     }
  26.                 }
  27.             }
  28.         }
  29.     }
  30. }
Advertisement
Add Comment
Please, Sign In to add comment