title: R: get all combinations of three numbers that add up to 100
body: <p>I have three variables: X, Y, and Z. I want to find all the combinations of X, Y and Z that add up to 100. X, Y and Z can only take values between [0,100]. The ouput should look somehtinkg like this:</p>
  
  <pre><code>  X   Y   Z   Sum
  100   0   0   100
   99   1   0   100
   99   0   1   100
   98   2   0   100
   98   1   1   100
   98   0   2   100
  </code></pre>
  
  <p>and so on...</p>
  
  <p>Any suggestion on how to get all the possible combinations?</p>