Adding rows in matrix using java
<p>I have created a matrix in java using only loops. But I wanted to show the total of the row at the end. I have been trying to figure this out and I cannot come up with a solution. Any help would be appreciated.</p>

<p>This is the code I have so far</p>

<pre><code>public class Main {
    public static void main(String[] args) {

        int num = 4;
        int product = 0;

        for (int i = 1; i &lt;= num; i++) {

            for (int j = 1; j &lt;= num; j++) {

                 product = j * i;

                System.out.printf("\t" + product);


            }

            System.out.println();
        }
    }
}
</code></pre>
