fork(1) download
  1. //IncreaseList
  2. using System;
  3. using System.Collections;
  4. using System.Collections.Generic;
  5.  
  6. public class test2
  7. {
  8. public void IncreaseList(int start,ArrayList list , int n, int k)
  9. {
  10.  
  11. if(list.Count==k)
  12. { for(int i = 0 ; i< list.Count; i++)
  13. {
  14. Console.Write(list[i] + " ");
  15.  
  16. }
  17. Console.WriteLine();
  18. }
  19.  
  20. for(int i=start;i<=n; i++)
  21. {
  22. list.Add(i);
  23. IncreaseList( i+1,list,n,k );
  24. list.Remove(i);
  25. }
  26.  
  27. }
  28. }
  29.  
  30. public class Test
  31. {
  32. public static void Main()
  33. {
  34. ArrayList list = new ArrayList();
  35. test2 t= new test2();
  36. t.IncreaseList(1,list,6,5);
  37.  
  38. }
  39. }
Success #stdin #stdout 0.03s 24224KB
stdin
Standard input is empty
stdout
1 2 3 4 5 
1 2 3 4 6 
1 2 3 5 6 
1 2 4 5 6 
1 3 4 5 6 
2 3 4 5 6