title: Divide elements within multidimensional array?
body: <p>I am working with 1 array that has 2 elements (new int [10][2] to be specific) and I can't figure out how to get column 0 to be divided column 1 for each row.</p>
  
  <p>For instance: row 5 c0[20]c1[2] = should be interpreted by the program as 20÷2 and then output the answer as 10 for each row. My program currently isn't doing that. Where am I going wrong?</p>
  
  <pre><code>import java.util.Scanner;
  
  public class 2darraydivision {
      public static void main(String[] args) {
          int[][] a = getArray();
          System.out.print("");
          for (int i = 0; i &lt; a.length; i++) {
              System.out.printf("\nStudent %d needs ", i + 1);
              System.out.printf(sum(a) + " terms to graduate.");
          }
          System.out.println("\n\nData captured from user:");
          for (int row = 0; row &lt; a.length; row++) {
              for (int column = 0; column &lt; a[row].length; column++) {
                  System.out.print(a[row][column] + " ");
              }
              System.out.println();
          }
      }
  
      public static int[][] getArray() {
          int[][] b = new int[10][2];
          java.util.Scanner input = new Scanner(System.in);
          System.out.print("Enter classes remaining and taking each term for...\n");
          for (int i = 0; i &lt; b.length; i++) {
              System.out.printf("Student %d: ", i + 1);
              for (int j = 0; j &lt; b[i].length; j++) {
                  b[i][j] = input.nextInt();
                  if ((b[j][0] &lt; 1) || (b[j][0] &gt; 20)) {
                      System.out.println("Please enter number of courses remaining between 1 and 20.");
                  } else if ((b[j][1] &lt; 1) || (b[j][1] &gt; 5)) {
                      System.out.println("Please enter number of courses taking between 1 and 5.");
                  }
              }
          }
          input.close();
          return b;
      }
  
      public static int sum(int[][] b) {
          int total = 0;
          for (int i = 0; i &lt; b.length; i++) {
              for (int j = 0; j &lt; b[j].length; j++) {
                  total = b[j][0] / b[j][1];
              }
          }
          return total;
      }
  }
  </code></pre>