title: find the components
body: <p>all. I'm making a easy function that can find the components of an integer</p>
  
  <p>for example, if I input 4 6 4 3 2 2 1 1 , </p>
  
  <p>means i have to find the components of the number '4' (1st) from </p>
  
  <p>the followed 6 (2nd) elements 4,3,2,2,1,1</p>
  
  <p>so the expected output is like
  4
  3+1
  2+2
  2+1+1</p>
  
  <p>and when you can't find any of the componets,  print NONE.</p>
  
  <p>My function is like :</p>
  
  <pre><code>int Addition(int command[], int target, int length ){
  /* command : the input line
     length : the amount of elements need to be checked */ 
  
      int i = 0, j = 1, k = 0;
      int sum = command[0];
      int content[length];
  
      content[0] = command[0];
  
      while(j &lt;= length){
          if(sum == target){
              for(i = 0; i &lt; k; ++i){
                  printf("%d+", content[i]);
              }
              printf("%d\n", content[i]);
              sum = command[0];
              k = 0;
              ++counter;
          }
          sum += command[j];
  
          if(sum &gt; target){
              sum -= command[j];
          }else{
              ++k;
              content[k] = command[j];
          }
          ++j;
      }
      if( length == 0 &amp;&amp; counter == 0 )
          printf("NONE\n");
      else{
          return Addition(command+1, target, length-1);
      }
  }
  </code></pre>
  
  <p>my problem is that i don't know how to set up the condition </p>
  
  <p>to print NONE when there's no components ,and I can't avoid </p>
  
  <p>printing the same answer. My output is like :</p>
  
  <p>Sums of 4:
  4
  4
  4
  4
  4
  4
  4
  3+1
  3+1
  2+2
  2+1+1
  2+1+1
  NONE</p>
  
  <p>sorry for the long description, but can someone give me some hint to my problems ??</p>
  
  <p>thank you!</p>