public void swapTwoNumber (ref int a, ref int b)
public void prnPermut (int []list, int k, int m)
Console.Write ("{0}",list [i]);
swapTwoNumber (ref list [k], ref list [i]);
prnPermut (list, k+1, m);
swapTwoNumber (ref list [k], ref list [i]);
public class RecExercise11
public static void Main()
formPermut test = new formPermut();
Console.WriteLine("\n\n Recursion : Generate all possible permutations of an array :");
Console.WriteLine("------------------------------------------------------------------");
Console.Write(" Input the number of elements to store in the array [maximum 5 digits ] :");
n = Convert.ToInt32(Console.ReadLine());
Console.Write(" Input {0} number of elements in the array :\n",n);
Console.Write(" element - {0} : ",i);
arr1[i] = Convert.ToInt32(Console.ReadLine());
Console.Write ("\n The Permutations with a combination of {0} digits are : \n",n);
test.prnPermut(arr1, 0, n-1);