Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- class VariationsN
- {
- static int number;
- static int numberOfLoops;
- static int[] vector;
- static void Main()
- {
- Console.Write("n = ");
- number = int.Parse(Console.ReadLine());
- numberOfLoops = number;
- vector = new int[numberOfLoops];
- Generic(0);
- }
- static void Generic(int currentLoop)
- {
- if (currentLoop == numberOfLoops)
- {
- Print();
- return;
- }
- else
- {
- for (int i = 1; i <= numberOfLoops; i++)
- {
- vector[currentLoop] = i;
- Generic(currentLoop + 1);
- }
- }
- }
- static void Print()
- {
- foreach (int c in vector)
- {
- Console.Write("{0} ", c);
- }
- Console.WriteLine();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement