%solution to Problem 2, homework set 1
% this script takes in an arbitrary integer
% n and returns an n*n matrix whos entries
% count from 1 up to n^2, reading left to
% right, top to bottom

  % read in input integer from user:
  n = input('Please input any positive integer:');
  
  
  % create vector "temp" which has entries 1,2,3,4,.....,n^2
  temp = [1:n^2];
  
  % create final matrix by reshaping vector temp into an nxn matrix
  y = reshape(temp, n, n)';

