Advertisement
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;
- namespace ConsoleApplication1
- {
- class Program
- {
- static int count;
- static void Megjelenit(int[] X, int n)
- {
- Console.Write("{0, 3} -> ", count);
- for (int i = 0; i < n; i++)
- {
- Console.Write(X[i]);
- }
- Console.WriteLine();
- }
- static void Nos(int[] X, int m, int n, int k)
- {
- if (k > 0)
- {
- for (int i = 0; i < m; i++)
- {
- X[n - k] = i;
- Nos(X, m, n, k - 1);
- }
- }
- else
- {
- count++;
- Megjelenit(X, n);
- }
- }
- static void Main(string[] args)
- {
- int n = 2, k = 3;
- int[] A = new int[k];
- Nos(A, n, k, k);
- Console.ReadKey();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement