title: Printing a Square Matrix and Transposing it with Java
body: <p>I need to write a program that will take a number n from the user and create an nxn matrix that counts up, then I need to transpose it. I've tried multiple methods of coding, but nothing displays correctly.</p>
  
  <pre><code>import java.util.Scanner;
  
  public class SquareMatrix {
    public static void main(String[] args)
  {
      //Variables
      int size;
      int value;
  
      //Scanner
      @SuppressWarnings("resource")
      Scanner input = new Scanner(System.in);
  
      //Prompt
      System.out.println("Enter the size of the Square Matrix: ");
      size = input.nextInt();
  
  
      for(int i=1; i&lt;=size; i++) {
          System.out.println();
  
          for(int j=0; j&lt;size; j++) {
  
              value = i+j;
              System.out.print(value);
  
          }
       }
  
    }
  
  }
  </code></pre>
  
  <p>The result I'm currently getting is:</p>
  
  <pre><code>Enter the size of the Square Matrix: 
  3
  
  123
  234
  345
  </code></pre>
  
  <p>I need it to look more like this:</p>
  
  <pre><code>Enter the Size of the Square Matrix:
  3
  Square Matrix:
  1 2 3 
  4 5 6 
  7 8 9 
  Transpose:
  1 4 7 
  2 5 8 
  3 6 9 
  </code></pre>