title: Calculating the sum of each digit of an Integer value
body: <p>In this exercise, I was suppose to grab any Integer and calculate the some of each digit.
  I found the best way to do this would be to use the method below. Converting to a string and reading each character one by one and totaling the sum of each while in a for loop. </p>
  
  <pre><code>import java.util.InputMismatchException;
  import java.util.Scanner;
  
  
  public class SommeChiffreNombre {
  
      /**
       * @param args
       * 
       * Demandez à l’usager d’entrer un nombre entier
       * Ensuite, calculez la somme de tous les chiffres de ce
       * nombre et affichez le résultat.
       * 
       * L’affichage obtenu doit être semblable aux suivants :
       * 
       * Entrez un nombre entier :
       * 5361
       * La somme des chiffres est : 15
       * 
       * 
       */
      public static void main(String[] args) {
          // TODO Auto-generated method stub
  
          try {
              System.out.print("Entrez un nombre entier : ");
              Scanner in = new Scanner(System.in);
              int nb = in.nextInt();
              in.close();
              int somme = 0;
  
              for(int i=0;i&lt;Integer.toString(nb).length();i++){
                  char charVal = Integer.toString(nb).charAt(i);
                  somme += Character.getNumericValue(charVal); 
              }
              System.out.println("La somme des chiffres est : "+somme);
          } catch (InputMismatchException e) {
              // TODO Auto-generated catch block
              System.out.println("You didn't enter an Integer Value");
          }
      }
  }
  </code></pre>
  
  <p>Apparently, this is not the way it should have been done. Even though I won't get points taken off by doing it this way. </p>
  
  <p>There is a simpler way <strong>using only an integer without converting or cast to another type</strong>
  Do anyone know how to accomplish this task ?</p>