Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Program
- {
- static string[] extractedwords;
- static string[] words;
- static int margin;
- static int n;
- static int k;
- static void Main(string[] args)
- {
- words = new string[4] { "coffee", "white", "blue", "chocolate"};
- Console.WriteLine("Dati n:");
- margin = int.Parse(Console.ReadLine());
- GenerateWords(1);
- }
- static void GenerateWords(int n)
- {
- if (n == margin)
- {
- return;
- }
- for (int a = 0; a < n; a++)
- {
- for (int c = 0; c < words.Length; c++)
- {
- extractedwords[a] = words[c];
- PrintWords(extractedwords);
- }
- GenerateWords(n + 1);
- }
- }
- static void PrintWords(string[] words)
- {
- for (int n = 0; n < words.Length; n++)
- {
- if (words[n] == null)
- {
- return;
- }
- Console.Write("{0} ", words[n]);
- }
- Console.WriteLine();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement