title: Adding numbers digits to number
body: <p>For my program, I'd want to code an array 1-100. In that array, I want to store the number + their digits. For example, if the number is 6 the stored value would be 6 because of 6 + 6 = 12. If the number is 17 the stored value should be 25 because 17 + 1 + 7 = 25. I want to do it for every number. My code has a method and 2 for loops but currently outputs everything as 0; Here's my code.</p>
  
  <pre><code>public class GeneratedNums {
  
  public static void main(String[] args) {
  
      int [] numbers = new int [101]; 
  
      for ( int x=0; x &lt; 101; x++){
          numbers[x] = sumDigits (x);
  
  
      }
  
      for ( int x=0; x &lt; numbers.length; x++){
          System.out.println(x + ": " + numbers[x]);
      }
  
  
  }
  
  public static int sumDigits ( int num) {
  
     int sum = num;
  
     while ( num != 0){
         num += num%10;
         num /= 10;
     }
        return num;
  }
  }
  </code></pre>