Java Simple program using Loop structure : <p>Sample input : 3456
Sample output : 
Digits : 3, 4, 5, 6
Sum : 18</p>

<p>This is the code that I had try, but unfortunately it is wrong since i do not use loop.Please anybody can help me?</p>

<pre><code>import java.util.Scanner;

public class Lab1_5 {
    public static void main (String args[])
    {
        int insert1, insert2, insert3, insert4;
        int sum ;

        Scanner console = new Scanner(System.in);

         System.out.print("Please enter First Number: ");
         insert1 =console.nextInt();
         System.out.print("Please enter Second Number: ");
         insert2 =console.nextInt();
         System.out.print("Please enter Third Number: ");
         insert3 =console.nextInt();
         System.out.print("Please enter Fourth Number: ");
         insert4 =console.nextInt();

         System.out.println("Digits: "+ insert1+","+insert2+","+insert3+","+insert4);

         sum = insert1+insert2+insert3+insert4;
         System.out.print("Sum: "+ sum);

    }

}
</code></pre>
