Advertisement
ntamas

mit csinál?

Nov 12th, 2014
198
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.82 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5.  
  6. namespace ConsoleApplication1
  7. {
  8.   class Program
  9.   {
  10.     static int count;
  11.     static void Megjelenit(int[] X, int n)
  12.     {
  13.       Console.Write("{0, 3} -> ", count);
  14.       for (int i = 0; i < n; i++)
  15.       {
  16.         Console.Write(X[i]);
  17.       }
  18.       Console.WriteLine();
  19.     }
  20.     static void Nos(int[] X, int m, int n, int k)
  21.     {
  22.       if (k > 0)
  23.       {
  24.         for (int i = 0; i < m; i++)
  25.         {
  26.           X[n - k] = i;
  27.           Nos(X, m, n, k - 1);
  28.         }
  29.       }
  30.       else
  31.       {
  32.         count++;
  33.         Megjelenit(X, n);
  34.       }
  35.     }
  36.     static void Main(string[] args)
  37.     {
  38.       int n = 2, k = 3;
  39.       int[] A = new int[k];
  40.       Nos(A, n, k, k);
  41.       Console.ReadKey();
  42.     }
  43.   }
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement