Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace NestedLoopsDemo
- {
- class LettersCombinations
- {
- static void Main(string[] args)
- {
- char startChar = char.Parse(Console.ReadLine());
- char endChar = char.Parse(Console.ReadLine());
- char bannedChar = char.Parse(Console.ReadLine());
- int printCount = 0;
- for (char i = startChar; i <= endChar; i++)
- {
- for (char j = startChar; j <= endChar; j++)
- {
- for (char k = startChar; k <= endChar; k++)
- {
- bool wordIsValid = i != bannedChar &&
- j != bannedChar &&
- k != bannedChar;
- if (!wordIsValid)
- {
- continue;
- }
- Console.Write($"{i}{j}{k} ");
- printCount++;
- }
- }
- }
- Console.WriteLine(printCount);
- }
- }
- }
Add Comment
Please, Sign In to add comment