Write a function named number_square
that accepts two integer parameters, a $min
and a $max
,
and prints the numbers in the range from $min
to $max
inclusive in a square pattern.
Each line of the square consists of a wrapping sequence of integers increasing from $min
and $max
.
The first line begins with $min
, the second line begins with $min
+ 1, and so on.
When the sequence in any line reaches $max
, it wraps around back to $min
.
For example, the call of number_square(1, 5)
should print:
12345
23451
34512
45123
51234
If either $min
or $max
are negative, your function should throw an Exception
with the message,
"Error: min and max must be non-negative". Otherwise, if passed a value for $min
that is greater than $max
, your function should throw an Exception
with the message,
"Error: min must be less than or equal to max". You may assume that $min
and
$max
are both integers.