  #include <iostream>
  
  using namespace std;
  
  void printSeq(int num, int a[], int opIndx,int s){
      if(num <= 0){
          //Display the output
          for(int j = 0; j < opIndx; j++)
              cout << a[j] << ",";
          cout << endl;
          return;
      }
  
      // s starts from 1 and later it will change to
      // 2, 3, 4, 5.
      // It is the case$
      // 5 = 2 + (3)
      // 5 = 3 + (2)
      // 5 = 4 + (1)
      // 5 = 5 + (0)
      for(int i = s; i <= num; i++){
          a[opIndx] = i;
          printSeq(num-i, a, opIndx + 1, i);
      }
  }   
  
  int main(){
      int a[15];
      printSeq(5, a, 0, 1);
      return 0;
  }