VelizarAvramov

06. Triples of Letters

Nov 5th, 2018
165
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.19 KB | None | 0 0
  1. using System;
  2.  
  3. namespace _06._Triples_of_Letters
  4. {
  5.     class TriplesOfLetters
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             //Write a program to read an integer n and print all triples of the first n small Latin letters, ordered alphabetically:
  10.             int n = int.Parse(Console.ReadLine());
  11.  
  12.             //for (int i = 0; i <= n-1; i++)
  13.             //{
  14.             //    for (int j = 0; j <= n-1; j++)
  15.             //    {
  16.             //        for (int k = 0; k <= n-1; k++)
  17.             //        {
  18.             //            char letterI = (char)('a' + i);
  19.             //            char letterJ = (char)('a' + j);
  20.             //            char letterK = (char)('a' + k);
  21.             //            Console.WriteLine($"{letterI}{letterJ}{letterK}");
  22.             //        }
  23.             //    }
  24.             //}
  25.             for (char i = 'a'; i < 'a' + n; i++)
  26.             {
  27.                 for (char j = 'a'; j < 'a' + n; j++)
  28.                 {
  29.                     for (char k = 'a'; k < 'a' + n; k++)
  30.                     {
  31.                         Console.WriteLine($"{i}{j}{k}");
  32.  
  33.                     }
  34.                 }
  35.             }
  36.         }
  37.     }
  38. }
Advertisement
Add Comment
Please, Sign In to add comment