JAVA ISBN-10 Number: Find 10th digit : <p><strong>Question :</strong> </p>

<p>An ISBN-10 consists of 10 digits: d1,d2,d3,d4,d5,d6,d7,d8,d9,d10. The last digit, d10, is a checksum,which is calculated from the other nine digits using 
<em>the following formula:</em></p>

<p><strong>(d1 * 1 + d2 * 2 + d3 * 3 + d4 * 4 + d5 * 5 + d6 * 6 + d7 * 7 + d8 * 8 + d9 * 9) % 11</strong></p>

<p>If the checksum is 10, the last digit is denoted as X according to the ISBN-10
convention. </p>

<p>Write a program that prompts the user to enter the first 9 digits and displays the 10-digit ISBN (including leading zeros). Your program should read the input as an integer.</p>

<p><em>Here are sample runs:</em></p>

<p><strong>Enter the first 9 digits of an ISBN as integer: 013601267</strong></p>

<p><strong>The ISBN-10 number is 0136012671</strong></p>

<p><strong>MY CODE:</strong></p>

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

public class ISBN_Number {

    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);

        int[] num = new int[9];

        System.out.println("Enter the first 9 digits of the an ISBN as integer: ");

        for (int i = 0; i &lt; num.length; i++) {
            for (int j = 1; j &lt; 10; j++) {
                num[i] = s.nextInt() * j;
            }
        }

        int sum = 0;
        for (int a = 0; a &lt; 10; a++) {
            sum += num[a];
        }
        int d10 = (sum % 11);
        System.out.println(d10);

        if (d10 == 10) {
            System.out.println("The ISBN-10 number is " + num + "X");
        } else {
            System.out.println("The ISBN-10 number is" + num);
        }
    }
}
</code></pre>

<p><strong>ISSUE:</strong>
I am new to learning java, hence I am having trouble trying to figure this question out. Can some tell me where I am going wrong because I am not getting the expected outcome. Thank you.</p>
