title: Create a java application that displays the sum of the digits of a number
body: <p>I am relatively new to Java and I'm currently learning while, do while and for loops. I want to create an application that displays the sum of the digits of a number using these concepts but I have no idea how. I previously created an application that displayed ONLY THE DIGITS of a number. Here it is.</p>
  
  <pre><code>int digit;
  Scanner input = new Scanner(System.in);
  
  do {
      System.out.println("Enter a positive integer: ");
      digit = input.nextInt();
  } while (digit &lt;= 0);
  input.close();
  
  String sdigit = digit + "";
  for (int i = 0; i &lt; sdigit.length(); i++){
      System.out.println(sdigit.charAt(i));
  }
  </code></pre>
  
  <p>I'm trying to think of a possible way to expand on this program, but I have no idea why. Once again, this program is not what I need, what I need is somehow to sum the digits of a number using for or while loops. Thank you!</p>